From 66fcbe63bf2c6dae4171b4a1ecfb9932ad89a05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Thu, 22 Jun 2023 14:03:16 +0200 Subject: [PATCH 1/3] Remove required unmarshal in models We can use the same struct just tweaking pointers. --- .generator/poetry.lock | 123 +++++------ .../src/generator/templates/model_simple.j2 | 49 ++--- .pre-commit-config.yaml | 4 +- .../model_add_signal_to_incident_request.go | 20 +- .../model_alert_graph_widget_definition.go | 50 ++--- .../model_alert_value_widget_definition.go | 43 ++-- api/datadogV1/model_api_error_response.go | 20 +- api/datadogV1/model_api_key.go | 3 +- api/datadogV1/model_api_key_list_response.go | 3 +- api/datadogV1/model_api_key_response.go | 3 +- .../model_apm_stats_query_column_type.go | 20 +- .../model_apm_stats_query_definition.go | 56 ++--- api/datadogV1/model_application_key.go | 3 +- .../model_application_key_list_response.go | 3 +- .../model_application_key_response.go | 3 +- ...odel_authentication_validation_response.go | 3 +- api/datadogV1/model_aws_account.go | 3 +- .../model_aws_account_and_lambda_request.go | 29 +-- .../model_aws_account_create_response.go | 3 +- .../model_aws_account_delete_request.go | 3 +- .../model_aws_account_list_response.go | 3 +- api/datadogV1/model_aws_logs_async_error.go | 3 +- .../model_aws_logs_async_response.go | 3 +- api/datadogV1/model_aws_logs_lambda.go | 3 +- api/datadogV1/model_aws_logs_list_response.go | 3 +- .../model_aws_logs_list_services_response.go | 3 +- .../model_aws_logs_services_request.go | 29 +-- api/datadogV1/model_aws_tag_filter.go | 3 +- .../model_aws_tag_filter_create_request.go | 3 +- .../model_aws_tag_filter_delete_request.go | 3 +- .../model_aws_tag_filter_list_response.go | 3 +- api/datadogV1/model_azure_account.go | 3 +- ...model_cancel_downtimes_by_scope_request.go | 20 +- api/datadogV1/model_canceled_downtimes_ids.go | 3 +- .../model_change_widget_definition.go | 41 ++-- api/datadogV1/model_change_widget_request.go | 3 +- ...model_check_can_delete_monitor_response.go | 22 +- ..._check_can_delete_monitor_response_data.go | 3 +- .../model_check_can_delete_slo_response.go | 3 +- ...odel_check_can_delete_slo_response_data.go | 3 +- .../model_check_status_widget_definition.go | 56 +++-- api/datadogV1/model_creator.go | 3 +- api/datadogV1/model_dashboard.go | 42 ++-- .../model_dashboard_bulk_action_data.go | 29 +-- .../model_dashboard_bulk_delete_request.go | 20 +- .../model_dashboard_delete_response.go | 3 +- api/datadogV1/model_dashboard_global_time.go | 3 +- api/datadogV1/model_dashboard_list.go | 20 +- .../model_dashboard_list_delete_response.go | 3 +- .../model_dashboard_list_list_response.go | 3 +- .../model_dashboard_restore_request.go | 20 +- api/datadogV1/model_dashboard_summary.go | 3 +- .../model_dashboard_summary_definition.go | 3 +- .../model_dashboard_template_variable.go | 20 +- ...odel_dashboard_template_variable_preset.go | 3 +- ...ashboard_template_variable_preset_value.go | 3 +- .../model_delete_shared_dashboard_response.go | 3 +- api/datadogV1/model_deleted_monitor.go | 3 +- .../model_distribution_points_payload.go | 20 +- .../model_distribution_points_series.go | 35 ++-- .../model_distribution_widget_definition.go | 49 ++--- .../model_distribution_widget_request.go | 3 +- .../model_distribution_widget_x_axis.go | 3 +- .../model_distribution_widget_y_axis.go | 3 +- api/datadogV1/model_downtime.go | 3 +- api/datadogV1/model_downtime_child.go | 3 +- api/datadogV1/model_downtime_recurrence.go | 3 +- api/datadogV1/model_event.go | 3 +- api/datadogV1/model_event_create_request.go | 31 +-- api/datadogV1/model_event_create_response.go | 3 +- api/datadogV1/model_event_list_response.go | 3 +- api/datadogV1/model_event_query_definition.go | 29 +-- api/datadogV1/model_event_response.go | 3 +- .../model_event_stream_widget_definition.go | 43 ++-- .../model_event_timeline_widget_definition.go | 41 ++-- ...n_apm_dependency_stats_query_definition.go | 76 +++---- ...ion_apm_resource_stats_query_definition.go | 66 +++--- ...ula_and_function_event_query_definition.go | 46 ++--- ...function_event_query_definition_compute.go | 24 +-- ..._function_event_query_definition_search.go | 20 +- ...rmula_and_function_event_query_group_by.go | 20 +- ..._and_function_event_query_group_by_sort.go | 24 +-- ...la_and_function_metric_query_definition.go | 42 ++-- ...a_and_function_process_query_definition.go | 54 ++--- ...rmula_and_function_slo_query_definition.go | 48 ++--- .../model_free_text_widget_definition.go | 37 ++-- api/datadogV1/model_funnel_query.go | 38 ++-- api/datadogV1/model_funnel_step.go | 29 +-- .../model_funnel_widget_definition.go | 39 ++-- api/datadogV1/model_funnel_widget_request.go | 29 +-- api/datadogV1/model_gcp_account.go | 3 +- .../model_geomap_widget_definition.go | 59 +++--- .../model_geomap_widget_definition_style.go | 29 +-- .../model_geomap_widget_definition_view.go | 20 +- api/datadogV1/model_geomap_widget_request.go | 3 +- api/datadogV1/model_graph_snapshot.go | 3 +- .../model_group_widget_definition.go | 52 ++--- .../model_heat_map_widget_definition.go | 49 ++--- .../model_heat_map_widget_request.go | 3 +- api/datadogV1/model_host.go | 3 +- api/datadogV1/model_host_list_response.go | 3 +- api/datadogV1/model_host_map_request.go | 3 +- .../model_host_map_widget_definition.go | 53 ++--- ...del_host_map_widget_definition_requests.go | 3 +- .../model_host_map_widget_definition_style.go | 3 +- api/datadogV1/model_host_meta.go | 3 +- .../model_host_meta_install_method.go | 3 +- api/datadogV1/model_host_metrics.go | 3 +- api/datadogV1/model_host_mute_response.go | 3 +- api/datadogV1/model_host_mute_settings.go | 3 +- api/datadogV1/model_host_tags.go | 3 +- api/datadogV1/model_host_totals.go | 3 +- .../model_hourly_usage_attribution_body.go | 3 +- ...model_hourly_usage_attribution_metadata.go | 3 +- ...del_hourly_usage_attribution_pagination.go | 3 +- ...model_hourly_usage_attribution_response.go | 3 +- api/datadogV1/model_http_log_error.go | 29 +-- api/datadogV1/model_http_log_item.go | 20 +- .../model_i_frame_widget_definition.go | 29 +-- api/datadogV1/model_idp_form_data.go | 20 +- api/datadogV1/model_idp_response.go | 20 +- .../model_image_widget_definition.go | 45 ++-- .../model_intake_payload_accepted.go | 3 +- api/datadogV1/model_ip_prefixes_agents.go | 3 +- api/datadogV1/model_ip_prefixes_api.go | 3 +- api/datadogV1/model_ip_prefixes_apm.go | 3 +- api/datadogV1/model_ip_prefixes_logs.go | 3 +- .../model_ip_prefixes_orchestrator.go | 3 +- api/datadogV1/model_ip_prefixes_process.go | 3 +- api/datadogV1/model_ip_prefixes_synthetics.go | 3 +- ...p_prefixes_synthetics_private_locations.go | 3 +- api/datadogV1/model_ip_prefixes_webhooks.go | 3 +- api/datadogV1/model_ip_ranges.go | 3 +- api/datadogV1/model_list_stream_column.go | 29 +-- .../model_list_stream_compute_items.go | 22 +- .../model_list_stream_group_by_items.go | 20 +- api/datadogV1/model_list_stream_query.go | 31 +-- .../model_list_stream_widget_definition.go | 43 ++-- .../model_list_stream_widget_request.go | 38 ++-- api/datadogV1/model_log.go | 3 +- api/datadogV1/model_log_content.go | 3 +- api/datadogV1/model_log_query_definition.go | 3 +- .../model_log_query_definition_group_by.go | 20 +- ...odel_log_query_definition_group_by_sort.go | 31 +-- .../model_log_query_definition_search.go | 20 +- .../model_log_stream_widget_definition.go | 44 ++-- api/datadogV1/model_logs_api_error.go | 3 +- .../model_logs_api_error_response.go | 3 +- .../model_logs_arithmetic_processor.go | 48 ++--- .../model_logs_attribute_remapper.go | 56 +++-- api/datadogV1/model_logs_by_retention.go | 3 +- .../model_logs_by_retention_monthly_usage.go | 3 +- .../model_logs_by_retention_org_usage.go | 3 +- api/datadogV1/model_logs_by_retention_orgs.go | 3 +- .../model_logs_category_processor.go | 42 ++-- .../model_logs_category_processor_category.go | 3 +- api/datadogV1/model_logs_date_remapper.go | 35 ++-- api/datadogV1/model_logs_exclusion.go | 20 +- api/datadogV1/model_logs_exclusion_filter.go | 22 +- api/datadogV1/model_logs_filter.go | 3 +- api/datadogV1/model_logs_geo_ip_parser.go | 46 ++--- api/datadogV1/model_logs_grok_parser.go | 48 ++--- api/datadogV1/model_logs_grok_parser_rules.go | 20 +- api/datadogV1/model_logs_index.go | 31 +-- .../model_logs_index_list_response.go | 3 +- .../model_logs_index_update_request.go | 20 +- api/datadogV1/model_logs_indexes_order.go | 20 +- api/datadogV1/model_logs_list_request.go | 30 +-- api/datadogV1/model_logs_list_request_time.go | 33 ++- api/datadogV1/model_logs_list_response.go | 3 +- api/datadogV1/model_logs_lookup_processor.go | 55 ++--- api/datadogV1/model_logs_message_remapper.go | 35 ++-- api/datadogV1/model_logs_pipeline.go | 20 +- .../model_logs_pipeline_processor.go | 28 +-- api/datadogV1/model_logs_pipelines_order.go | 20 +- api/datadogV1/model_logs_query_compute.go | 20 +- .../model_logs_retention_agg_sum_usage.go | 3 +- .../model_logs_retention_sum_usage.go | 3 +- api/datadogV1/model_logs_service_remapper.go | 35 ++-- api/datadogV1/model_logs_status_remapper.go | 35 ++-- .../model_logs_string_builder_processor.go | 48 ++--- api/datadogV1/model_logs_trace_remapper.go | 26 +-- api/datadogV1/model_logs_url_parser.go | 42 ++-- api/datadogV1/model_logs_user_agent_parser.go | 48 ++--- api/datadogV1/model_matching_downtime.go | 20 +- api/datadogV1/model_metric_metadata.go | 3 +- api/datadogV1/model_metric_search_response.go | 3 +- .../model_metric_search_response_results.go | 3 +- api/datadogV1/model_metrics_list_response.go | 3 +- api/datadogV1/model_metrics_payload.go | 20 +- api/datadogV1/model_metrics_query_metadata.go | 3 +- api/datadogV1/model_metrics_query_response.go | 3 +- api/datadogV1/model_metrics_query_unit.go | 3 +- api/datadogV1/model_monitor.go | 31 +-- ...ula_and_function_event_query_definition.go | 44 ++-- ...function_event_query_definition_compute.go | 24 +-- ..._function_event_query_definition_search.go | 20 +- ...rmula_and_function_event_query_group_by.go | 20 +- ..._and_function_event_query_group_by_sort.go | 24 +-- .../model_monitor_group_search_response.go | 3 +- ...el_monitor_group_search_response_counts.go | 3 +- .../model_monitor_group_search_result.go | 3 +- api/datadogV1/model_monitor_options.go | 3 +- .../model_monitor_options_aggregation.go | 3 +- ...odel_monitor_options_scheduling_options.go | 3 +- ...ns_scheduling_options_evaluation_window.go | 3 +- .../model_monitor_search_count_item.go | 3 +- .../model_monitor_search_response.go | 3 +- .../model_monitor_search_response_counts.go | 3 +- .../model_monitor_search_response_metadata.go | 3 +- api/datadogV1/model_monitor_search_result.go | 3 +- ...odel_monitor_search_result_notification.go | 3 +- api/datadogV1/model_monitor_state.go | 3 +- api/datadogV1/model_monitor_state_group.go | 3 +- ...model_monitor_summary_widget_definition.go | 55 +++-- .../model_monitor_threshold_window_options.go | 3 +- api/datadogV1/model_monitor_thresholds.go | 3 +- api/datadogV1/model_monitor_update_request.go | 3 +- .../model_monthly_usage_attribution_body.go | 3 +- ...odel_monthly_usage_attribution_metadata.go | 3 +- ...el_monthly_usage_attribution_pagination.go | 3 +- ...odel_monthly_usage_attribution_response.go | 3 +- .../model_monthly_usage_attribution_values.go | 3 +- api/datadogV1/model_note_widget_definition.go | 47 ++--- api/datadogV1/model_notebook_absolute_time.go | 31 +-- api/datadogV1/model_notebook_author.go | 3 +- .../model_notebook_cell_create_request.go | 29 +-- api/datadogV1/model_notebook_cell_response.go | 38 ++-- .../model_notebook_cell_update_request.go | 38 ++-- api/datadogV1/model_notebook_create_data.go | 29 +-- .../model_notebook_create_data_attributes.go | 46 ++--- .../model_notebook_create_request.go | 20 +- ...l_notebook_distribution_cell_attributes.go | 26 +-- ...model_notebook_heat_map_cell_attributes.go | 20 +- ...del_notebook_log_stream_cell_attributes.go | 24 +-- ...model_notebook_markdown_cell_attributes.go | 20 +- ...model_notebook_markdown_cell_definition.go | 29 +-- api/datadogV1/model_notebook_metadata.go | 3 +- api/datadogV1/model_notebook_relative_time.go | 20 +- api/datadogV1/model_notebook_response.go | 3 +- api/datadogV1/model_notebook_response_data.go | 38 ++-- ...model_notebook_response_data_attributes.go | 52 ++--- api/datadogV1/model_notebook_split_by.go | 29 +-- ...del_notebook_timeseries_cell_attributes.go | 26 +-- .../model_notebook_toplist_cell_attributes.go | 20 +- api/datadogV1/model_notebook_update_data.go | 29 +-- .../model_notebook_update_data_attributes.go | 46 ++--- .../model_notebook_update_request.go | 20 +- api/datadogV1/model_notebooks_response.go | 3 +- .../model_notebooks_response_data.go | 38 ++-- ...odel_notebooks_response_data_attributes.go | 20 +- .../model_notebooks_response_meta.go | 3 +- .../model_notebooks_response_page.go | 3 +- .../model_org_downgraded_response.go | 3 +- api/datadogV1/model_organization.go | 3 +- api/datadogV1/model_organization_billing.go | 3 +- .../model_organization_create_body.go | 20 +- .../model_organization_create_response.go | 3 +- .../model_organization_list_response.go | 3 +- api/datadogV1/model_organization_response.go | 3 +- api/datadogV1/model_organization_settings.go | 3 +- .../model_organization_settings_saml.go | 3 +- ..._settings_saml_autocreate_users_domains.go | 3 +- ...ation_settings_saml_idp_initiated_login.go | 3 +- ..._organization_settings_saml_strict_mode.go | 3 +- .../model_organization_subscription.go | 3 +- api/datadogV1/model_pager_duty_service.go | 29 +-- api/datadogV1/model_pager_duty_service_key.go | 20 +- .../model_pager_duty_service_name.go | 20 +- api/datadogV1/model_pagination.go | 3 +- .../model_process_query_definition.go | 20 +- .../model_query_value_widget_definition.go | 51 ++--- .../model_query_value_widget_request.go | 3 +- ...l_reference_table_logs_lookup_processor.go | 47 ++--- .../model_response_meta_attributes.go | 3 +- .../model_run_workflow_widget_definition.go | 43 ++-- .../model_run_workflow_widget_input.go | 29 +-- api/datadogV1/model_scatter_plot_request.go | 3 +- .../model_scatter_plot_widget_definition.go | 47 ++--- ...scatter_plot_widget_definition_requests.go | 3 +- .../model_scatterplot_table_request.go | 3 +- .../model_scatterplot_widget_formula.go | 31 +-- .../model_search_service_level_objective.go | 3 +- ...arch_service_level_objective_attributes.go | 3 +- ...del_search_service_level_objective_data.go | 3 +- api/datadogV1/model_search_slo_query.go | 3 +- api/datadogV1/model_search_slo_response.go | 3 +- .../model_search_slo_response_data.go | 3 +- ...del_search_slo_response_data_attributes.go | 3 +- ...rch_slo_response_data_attributes_facets.go | 3 +- ...ponse_data_attributes_facets_object_int.go | 3 +- ...se_data_attributes_facets_object_string.go | 3 +- .../model_search_slo_response_links.go | 3 +- .../model_search_slo_response_meta.go | 3 +- .../model_search_slo_response_meta_page.go | 3 +- api/datadogV1/model_search_slo_threshold.go | 31 +-- ...odel_selectable_template_variable_items.go | 3 +- api/datadogV1/model_series.go | 31 +-- api/datadogV1/model_service_check.go | 53 ++--- .../model_service_level_objective.go | 42 ++-- .../model_service_level_objective_query.go | 29 +-- .../model_service_level_objective_request.go | 42 ++-- .../model_service_map_widget_definition.go | 50 ++--- ...model_service_summary_widget_definition.go | 73 +++---- api/datadogV1/model_shared_dashboard.go | 31 +-- .../model_shared_dashboard_author.go | 3 +- .../model_shared_dashboard_invites.go | 20 +- ...el_shared_dashboard_invites_data_object.go | 29 +-- ...ashboard_invites_data_object_attributes.go | 3 +- .../model_shared_dashboard_invites_meta.go | 3 +- ...odel_shared_dashboard_invites_meta_page.go | 3 +- .../model_shared_dashboard_update_request.go | 16 +- ...ed_dashboard_update_request_global_time.go | 3 +- .../model_signal_assignee_update_request.go | 22 +- .../model_signal_state_update_request.go | 20 +- .../model_slack_integration_channel.go | 3 +- ...model_slack_integration_channel_display.go | 3 +- api/datadogV1/model_slo_bulk_delete_error.go | 38 ++-- .../model_slo_bulk_delete_response.go | 3 +- .../model_slo_bulk_delete_response_data.go | 3 +- api/datadogV1/model_slo_correction.go | 3 +- .../model_slo_correction_create_data.go | 20 +- .../model_slo_correction_create_request.go | 3 +- ...lo_correction_create_request_attributes.go | 52 ++--- .../model_slo_correction_list_response.go | 3 +- .../model_slo_correction_response.go | 3 +- ...odel_slo_correction_response_attributes.go | 3 +- ...correction_response_attributes_modifier.go | 3 +- .../model_slo_correction_update_data.go | 3 +- .../model_slo_correction_update_request.go | 3 +- ...lo_correction_update_request_attributes.go | 3 +- api/datadogV1/model_slo_creator.go | 3 +- api/datadogV1/model_slo_delete_response.go | 3 +- api/datadogV1/model_slo_history_metrics.go | 60 +++--- .../model_slo_history_metrics_series.go | 42 ++-- ...del_slo_history_metrics_series_metadata.go | 3 +- ...lo_history_metrics_series_metadata_unit.go | 3 +- api/datadogV1/model_slo_history_monitor.go | 3 +- api/datadogV1/model_slo_history_response.go | 3 +- .../model_slo_history_response_data.go | 3 +- .../model_slo_history_response_error.go | 3 +- ...el_slo_history_response_error_with_type.go | 29 +-- api/datadogV1/model_slo_history_sli_data.go | 3 +- api/datadogV1/model_slo_list_response.go | 3 +- .../model_slo_list_response_metadata.go | 3 +- .../model_slo_list_response_metadata_page.go | 3 +- .../model_slo_list_widget_definition.go | 37 ++-- api/datadogV1/model_slo_list_widget_query.go | 20 +- .../model_slo_list_widget_request.go | 29 +-- api/datadogV1/model_slo_overall_statuses.go | 3 +- .../model_slo_raw_error_budget_remaining.go | 3 +- api/datadogV1/model_slo_response.go | 3 +- api/datadogV1/model_slo_response_data.go | 3 +- api/datadogV1/model_slo_status.go | 3 +- api/datadogV1/model_slo_threshold.go | 37 ++-- api/datadogV1/model_slo_widget_definition.go | 49 ++--- ...model_successful_signal_update_response.go | 3 +- .../model_sunburst_widget_definition.go | 45 ++-- ...sunburst_widget_legend_inline_automatic.go | 24 +-- .../model_sunburst_widget_legend_table.go | 20 +- .../model_sunburst_widget_request.go | 3 +- api/datadogV1/model_synthetics_api_step.go | 49 ++--- api/datadogV1/model_synthetics_api_test_.go | 63 +++--- .../model_synthetics_api_test_config.go | 3 +- .../model_synthetics_api_test_result_data.go | 3 +- ...odel_synthetics_api_test_result_failure.go | 3 +- .../model_synthetics_api_test_result_full.go | 3 +- ...l_synthetics_api_test_result_full_check.go | 20 +- .../model_synthetics_api_test_result_short.go | 3 +- ...synthetics_api_test_result_short_result.go | 3 +- ...l_synthetics_assertion_json_path_target.go | 31 +-- ...etics_assertion_json_path_target_target.go | 3 +- .../model_synthetics_assertion_target.go | 40 ++-- ...odel_synthetics_assertion_x_path_target.go | 31 +-- ...nthetics_assertion_x_path_target_target.go | 3 +- .../model_synthetics_basic_auth_digest.go | 31 +-- .../model_synthetics_basic_auth_ntlm.go | 28 +-- ...odel_synthetics_basic_auth_oauth_client.go | 51 ++--- .../model_synthetics_basic_auth_oauth_rop.go | 55 ++--- .../model_synthetics_basic_auth_sigv4.go | 48 ++--- .../model_synthetics_basic_auth_web.go | 31 +-- .../model_synthetics_batch_details.go | 3 +- .../model_synthetics_batch_details_data.go | 3 +- .../model_synthetics_batch_result.go | 3 +- .../model_synthetics_browser_error.go | 40 ++-- .../model_synthetics_browser_test_.go | 63 +++--- .../model_synthetics_browser_test_config.go | 31 +-- ...del_synthetics_browser_test_result_data.go | 3 +- ..._synthetics_browser_test_result_failure.go | 3 +- ...del_synthetics_browser_test_result_full.go | 3 +- ...nthetics_browser_test_result_full_check.go | 20 +- ...el_synthetics_browser_test_result_short.go | 3 +- ...hetics_browser_test_result_short_result.go | 3 +- ...el_synthetics_browser_test_rum_settings.go | 20 +- .../model_synthetics_browser_variable.go | 39 ++-- .../model_synthetics_ci_batch_metadata.go | 3 +- .../model_synthetics_ci_batch_metadata_ci.go | 3 +- .../model_synthetics_ci_batch_metadata_git.go | 3 +- ...l_synthetics_ci_batch_metadata_pipeline.go | 3 +- ...l_synthetics_ci_batch_metadata_provider.go | 3 +- api/datadogV1/model_synthetics_ci_test_.go | 20 +- .../model_synthetics_ci_test_body.go | 3 +- .../model_synthetics_config_variable.go | 39 ++-- .../model_synthetics_core_web_vitals.go | 3 +- .../model_synthetics_delete_tests_payload.go | 3 +- .../model_synthetics_delete_tests_response.go | 3 +- .../model_synthetics_deleted_test_.go | 3 +- api/datadogV1/model_synthetics_device.go | 51 ++--- ...cs_get_api_test_latest_results_response.go | 3 +- ...et_browser_test_latest_results_response.go | 3 +- .../model_synthetics_global_variable.go | 49 ++--- ...l_synthetics_global_variable_attributes.go | 3 +- ...odel_synthetics_global_variable_options.go | 3 +- ...tics_global_variable_parse_test_options.go | 26 +-- ...thetics_global_variable_totp_parameters.go | 3 +- .../model_synthetics_global_variable_value.go | 3 +- ...nthetics_list_global_variables_response.go | 3 +- .../model_synthetics_list_tests_response.go | 3 +- api/datadogV1/model_synthetics_location.go | 3 +- api/datadogV1/model_synthetics_locations.go | 3 +- .../model_synthetics_parsing_options.go | 3 +- .../model_synthetics_private_location.go | 42 ++-- ...tics_private_location_creation_response.go | 3 +- ...ion_creation_response_result_encryption.go | 3 +- ...el_synthetics_private_location_metadata.go | 3 +- ...del_synthetics_private_location_secrets.go | 3 +- ...private_location_secrets_authentication.go | 3 +- ...vate_location_secrets_config_decryption.go | 3 +- .../model_synthetics_ssl_certificate.go | 3 +- ...model_synthetics_ssl_certificate_issuer.go | 3 +- ...odel_synthetics_ssl_certificate_subject.go | 3 +- api/datadogV1/model_synthetics_step.go | 3 +- api/datadogV1/model_synthetics_step_detail.go | 3 +- .../model_synthetics_step_detail_warning.go | 29 +-- .../model_synthetics_test_ci_options.go | 3 +- api/datadogV1/model_synthetics_test_config.go | 3 +- .../model_synthetics_test_details.go | 3 +- .../model_synthetics_test_options.go | 3 +- ...synthetics_test_options_monitor_options.go | 3 +- .../model_synthetics_test_options_retry.go | 3 +- ...odel_synthetics_test_options_scheduling.go | 3 +- ...etics_test_options_scheduling_timeframe.go | 3 +- .../model_synthetics_test_request.go | 3 +- ...del_synthetics_test_request_certificate.go | 3 +- ...ynthetics_test_request_certificate_item.go | 3 +- .../model_synthetics_test_request_proxy.go | 20 +- api/datadogV1/model_synthetics_timing.go | 3 +- .../model_synthetics_trigger_body.go | 20 +- ...del_synthetics_trigger_ci_test_location.go | 3 +- ...l_synthetics_trigger_ci_test_run_result.go | 3 +- ...el_synthetics_trigger_ci_tests_response.go | 3 +- .../model_synthetics_trigger_test_.go | 20 +- ...hetics_update_test_pause_status_payload.go | 3 +- .../model_synthetics_variable_parser.go | 22 +- .../model_table_widget_definition.go | 43 ++-- api/datadogV1/model_table_widget_request.go | 3 +- api/datadogV1/model_tag_to_hosts.go | 3 +- api/datadogV1/model_timeseries_background.go | 22 +- .../model_timeseries_widget_definition.go | 57 +++-- ...odel_timeseries_widget_expression_alias.go | 20 +- .../model_timeseries_widget_request.go | 3 +- .../model_toplist_widget_definition.go | 41 ++-- api/datadogV1/model_toplist_widget_request.go | 3 +- .../model_topology_map_widget_definition.go | 39 ++-- api/datadogV1/model_topology_query.go | 3 +- api/datadogV1/model_topology_request.go | 3 +- .../model_tree_map_widget_definition.go | 43 ++-- .../model_tree_map_widget_request.go | 3 +- .../model_usage_analyzed_logs_hour.go | 3 +- .../model_usage_analyzed_logs_response.go | 3 +- ...model_usage_attribution_aggregates_body.go | 3 +- api/datadogV1/model_usage_attribution_body.go | 3 +- .../model_usage_attribution_metadata.go | 3 +- .../model_usage_attribution_pagination.go | 3 +- .../model_usage_attribution_response.go | 3 +- .../model_usage_attribution_values.go | 3 +- api/datadogV1/model_usage_audit_logs_hour.go | 3 +- .../model_usage_audit_logs_response.go | 3 +- .../model_usage_billable_summary_body.go | 3 +- .../model_usage_billable_summary_hour.go | 3 +- .../model_usage_billable_summary_keys.go | 3 +- .../model_usage_billable_summary_response.go | 3 +- .../model_usage_ci_visibility_hour.go | 3 +- .../model_usage_ci_visibility_response.go | 3 +- ..._cloud_security_posture_management_hour.go | 3 +- ...ud_security_posture_management_response.go | 3 +- .../model_usage_custom_reports_attributes.go | 3 +- .../model_usage_custom_reports_data.go | 3 +- .../model_usage_custom_reports_meta.go | 3 +- .../model_usage_custom_reports_page.go | 3 +- .../model_usage_custom_reports_response.go | 3 +- api/datadogV1/model_usage_cws_hour.go | 3 +- api/datadogV1/model_usage_cws_response.go | 3 +- api/datadogV1/model_usage_dbm_hour.go | 3 +- api/datadogV1/model_usage_dbm_response.go | 3 +- api/datadogV1/model_usage_fargate_hour.go | 3 +- api/datadogV1/model_usage_fargate_response.go | 3 +- api/datadogV1/model_usage_host_hour.go | 3 +- api/datadogV1/model_usage_hosts_response.go | 3 +- .../model_usage_incident_management_hour.go | 3 +- ...odel_usage_incident_management_response.go | 3 +- .../model_usage_indexed_spans_hour.go | 3 +- .../model_usage_indexed_spans_response.go | 3 +- .../model_usage_ingested_spans_hour.go | 3 +- .../model_usage_ingested_spans_response.go | 3 +- api/datadogV1/model_usage_io_t_hour.go | 3 +- api/datadogV1/model_usage_io_t_response.go | 3 +- api/datadogV1/model_usage_lambda_hour.go | 3 +- api/datadogV1/model_usage_lambda_response.go | 3 +- .../model_usage_logs_by_index_hour.go | 3 +- .../model_usage_logs_by_index_response.go | 3 +- .../model_usage_logs_by_retention_hour.go | 3 +- .../model_usage_logs_by_retention_response.go | 3 +- api/datadogV1/model_usage_logs_hour.go | 3 +- api/datadogV1/model_usage_logs_response.go | 3 +- .../model_usage_network_flows_hour.go | 3 +- .../model_usage_network_flows_response.go | 3 +- .../model_usage_network_hosts_hour.go | 3 +- .../model_usage_network_hosts_response.go | 3 +- .../model_usage_online_archive_hour.go | 3 +- .../model_usage_online_archive_response.go | 3 +- api/datadogV1/model_usage_profiling_hour.go | 3 +- .../model_usage_profiling_response.go | 3 +- .../model_usage_rum_sessions_hour.go | 3 +- .../model_usage_rum_sessions_response.go | 3 +- api/datadogV1/model_usage_rum_units_hour.go | 3 +- .../model_usage_rum_units_response.go | 3 +- api/datadogV1/model_usage_sds_hour.go | 3 +- api/datadogV1/model_usage_sds_response.go | 3 +- api/datadogV1/model_usage_snmp_hour.go | 3 +- api/datadogV1/model_usage_snmp_response.go | 3 +- ...age_specified_custom_reports_attributes.go | 3 +- ...del_usage_specified_custom_reports_data.go | 3 +- ...del_usage_specified_custom_reports_meta.go | 3 +- ...del_usage_specified_custom_reports_page.go | 3 +- ...usage_specified_custom_reports_response.go | 3 +- api/datadogV1/model_usage_summary_date.go | 3 +- api/datadogV1/model_usage_summary_date_org.go | 3 +- api/datadogV1/model_usage_summary_response.go | 3 +- .../model_usage_synthetics_api_hour.go | 3 +- .../model_usage_synthetics_api_response.go | 3 +- .../model_usage_synthetics_browser_hour.go | 3 +- ...model_usage_synthetics_browser_response.go | 3 +- api/datadogV1/model_usage_synthetics_hour.go | 3 +- .../model_usage_synthetics_response.go | 3 +- api/datadogV1/model_usage_timeseries_hour.go | 3 +- .../model_usage_timeseries_response.go | 3 +- .../model_usage_top_avg_metrics_hour.go | 3 +- .../model_usage_top_avg_metrics_metadata.go | 3 +- .../model_usage_top_avg_metrics_pagination.go | 3 +- .../model_usage_top_avg_metrics_response.go | 3 +- api/datadogV1/model_user.go | 3 +- api/datadogV1/model_user_disable_response.go | 3 +- api/datadogV1/model_user_list_response.go | 3 +- api/datadogV1/model_user_response.go | 3 +- api/datadogV1/model_webhooks_integration.go | 31 +-- ...el_webhooks_integration_custom_variable.go | 38 ++-- ...ks_integration_custom_variable_response.go | 29 +-- ...egration_custom_variable_update_request.go | 3 +- ...del_webhooks_integration_update_request.go | 3 +- api/datadogV1/model_widget.go | 24 +-- api/datadogV1/model_widget_axis.go | 3 +- .../model_widget_conditional_format.go | 54 ++--- api/datadogV1/model_widget_custom_link.go | 3 +- api/datadogV1/model_widget_event.go | 20 +- api/datadogV1/model_widget_field_sort.go | 29 +-- api/datadogV1/model_widget_formula.go | 20 +- api/datadogV1/model_widget_formula_limit.go | 3 +- api/datadogV1/model_widget_formula_style.go | 3 +- api/datadogV1/model_widget_layout.go | 51 ++--- api/datadogV1/model_widget_marker.go | 20 +- api/datadogV1/model_widget_request_style.go | 3 +- api/datadogV1/model_widget_style.go | 3 +- api/datadogV1/model_widget_time.go | 3 +- api/datadogV2/model_api_error_response.go | 20 +- .../model_api_key_create_attributes.go | 20 +- api/datadogV2/model_api_key_create_data.go | 29 +-- api/datadogV2/model_api_key_create_request.go | 20 +- api/datadogV2/model_api_key_relationships.go | 3 +- api/datadogV2/model_api_key_response.go | 3 +- .../model_api_key_update_attributes.go | 20 +- api/datadogV2/model_api_key_update_data.go | 38 ++-- api/datadogV2/model_api_key_update_request.go | 20 +- api/datadogV2/model_api_keys_response.go | 3 +- ...model_application_key_create_attributes.go | 20 +- .../model_application_key_create_data.go | 29 +-- .../model_application_key_create_request.go | 20 +- .../model_application_key_relationships.go | 3 +- .../model_application_key_response.go | 3 +- ...model_application_key_update_attributes.go | 3 +- .../model_application_key_update_data.go | 38 ++-- .../model_application_key_update_request.go | 20 +- api/datadogV2/model_audit_logs_event.go | 3 +- .../model_audit_logs_event_attributes.go | 3 +- .../model_audit_logs_events_response.go | 3 +- .../model_audit_logs_query_filter.go | 3 +- .../model_audit_logs_query_options.go | 3 +- .../model_audit_logs_query_page_options.go | 3 +- .../model_audit_logs_response_links.go | 3 +- .../model_audit_logs_response_metadata.go | 3 +- .../model_audit_logs_response_page.go | 3 +- .../model_audit_logs_search_events_request.go | 3 +- api/datadogV2/model_audit_logs_warning.go | 3 +- api/datadogV2/model_auth_n_mapping.go | 31 +-- .../model_auth_n_mapping_attributes.go | 3 +- .../model_auth_n_mapping_create_attributes.go | 3 +- .../model_auth_n_mapping_create_data.go | 20 +- ...del_auth_n_mapping_create_relationships.go | 3 +- .../model_auth_n_mapping_create_request.go | 20 +- .../model_auth_n_mapping_relationships.go | 3 +- .../model_auth_n_mapping_response.go | 3 +- .../model_auth_n_mapping_update_attributes.go | 3 +- .../model_auth_n_mapping_update_data.go | 31 +-- ...del_auth_n_mapping_update_relationships.go | 3 +- .../model_auth_n_mapping_update_request.go | 20 +- .../model_auth_n_mappings_response.go | 3 +- api/datadogV2/model_chargeback_breakdown.go | 3 +- ...aggregate_bucket_value_timeseries_point.go | 3 +- api/datadogV2/model_ci_app_aggregate_sort.go | 3 +- api/datadogV2/model_ci_app_ci_error.go | 3 +- api/datadogV2/model_ci_app_compute.go | 26 +-- ...el_ci_app_create_pipeline_event_request.go | 3 +- ...reate_pipeline_event_request_attributes.go | 24 +-- ..._app_create_pipeline_event_request_data.go | 3 +- .../model_ci_app_event_attributes.go | 3 +- api/datadogV2/model_ci_app_git_info.go | 42 ++-- .../model_ci_app_group_by_histogram.go | 38 ++-- api/datadogV2/model_ci_app_host_info.go | 3 +- api/datadogV2/model_ci_app_pipeline_event.go | 3 +- .../model_ci_app_pipeline_event_job.go | 134 ++++++++++-- ...l_ci_app_pipeline_event_parent_pipeline.go | 20 +- .../model_ci_app_pipeline_event_pipeline.go | 117 +++++++++-- ...ci_app_pipeline_event_previous_pipeline.go | 20 +- .../model_ci_app_pipeline_event_stage.go | 109 +++++++++- .../model_ci_app_pipeline_event_step.go | 115 ++++++++++- .../model_ci_app_pipeline_events_request.go | 3 +- .../model_ci_app_pipeline_events_response.go | 3 +- ...odel_ci_app_pipelines_aggregate_request.go | 3 +- ..._pipelines_aggregation_buckets_response.go | 3 +- ..._pipelines_analytics_aggregate_response.go | 3 +- .../model_ci_app_pipelines_bucket_response.go | 3 +- .../model_ci_app_pipelines_group_by.go | 20 +- .../model_ci_app_pipelines_query_filter.go | 3 +- api/datadogV2/model_ci_app_query_options.go | 3 +- .../model_ci_app_query_page_options.go | 3 +- api/datadogV2/model_ci_app_response_links.go | 3 +- .../model_ci_app_response_metadata.go | 3 +- ...i_app_response_metadata_with_pagination.go | 3 +- api/datadogV2/model_ci_app_response_page.go | 3 +- api/datadogV2/model_ci_app_test_event.go | 3 +- .../model_ci_app_test_events_request.go | 3 +- .../model_ci_app_test_events_response.go | 3 +- .../model_ci_app_tests_aggregate_request.go | 3 +- ..._app_tests_aggregation_buckets_response.go | 3 +- ..._app_tests_analytics_aggregate_response.go | 3 +- .../model_ci_app_tests_bucket_response.go | 3 +- api/datadogV2/model_ci_app_tests_group_by.go | 20 +- .../model_ci_app_tests_query_filter.go | 3 +- api/datadogV2/model_ci_app_user_info.go | 195 ++++++++++++++++++ api/datadogV2/model_ci_app_warning.go | 3 +- ...d_configuration_compliance_rule_options.go | 3 +- .../model_cloud_configuration_rego_rule.go | 29 +-- ...el_cloud_configuration_rule_case_create.go | 22 +- ...guration_rule_compliance_signal_options.go | 3 +- ...cloud_configuration_rule_create_payload.go | 57 ++--- .../model_cloud_configuration_rule_options.go | 20 +- ...workload_security_agent_rule_attributes.go | 3 +- ...d_security_agent_rule_create_attributes.go | 31 +-- ...orkload_security_agent_rule_create_data.go | 29 +-- ...load_security_agent_rule_create_request.go | 20 +- ..._security_agent_rule_creator_attributes.go | 3 +- ...cloud_workload_security_agent_rule_data.go | 3 +- ...d_workload_security_agent_rule_response.go | 3 +- ...d_security_agent_rule_update_attributes.go | 3 +- ...orkload_security_agent_rule_update_data.go | 29 +-- ...load_security_agent_rule_update_request.go | 20 +- ..._security_agent_rule_updater_attributes.go | 3 +- ...load_security_agent_rules_list_response.go | 3 +- ...model_cloudflare_account_create_request.go | 20 +- ...flare_account_create_request_attributes.go | 31 +-- ..._cloudflare_account_create_request_data.go | 29 +-- .../model_cloudflare_account_response.go | 3 +- ..._cloudflare_account_response_attributes.go | 20 +- .../model_cloudflare_account_response_data.go | 38 ++-- ...model_cloudflare_account_update_request.go | 20 +- ...flare_account_update_request_attributes.go | 20 +- ..._cloudflare_account_update_request_data.go | 3 +- .../model_cloudflare_accounts_response.go | 3 +- .../model_confluent_account_create_request.go | 20 +- ...luent_account_create_request_attributes.go | 31 +-- ...l_confluent_account_create_request_data.go | 29 +-- ...l_confluent_account_resource_attributes.go | 20 +- .../model_confluent_account_response.go | 3 +- ...l_confluent_account_response_attributes.go | 20 +- .../model_confluent_account_response_data.go | 38 ++-- .../model_confluent_account_update_request.go | 20 +- ...luent_account_update_request_attributes.go | 31 +-- ...l_confluent_account_update_request_data.go | 29 +-- .../model_confluent_accounts_response.go | 3 +- .../model_confluent_resource_request.go | 20 +- ...l_confluent_resource_request_attributes.go | 20 +- .../model_confluent_resource_request_data.go | 38 ++-- .../model_confluent_resource_response.go | 3 +- ..._confluent_resource_response_attributes.go | 20 +- .../model_confluent_resource_response_data.go | 38 ++-- .../model_confluent_resources_response.go | 3 +- api/datadogV2/model_cost_by_org.go | 3 +- api/datadogV2/model_cost_by_org_attributes.go | 3 +- api/datadogV2/model_cost_by_org_response.go | 3 +- api/datadogV2/model_creator.go | 3 +- .../model_dashboard_list_add_items_request.go | 3 +- ...model_dashboard_list_add_items_response.go | 3 +- ...del_dashboard_list_delete_items_request.go | 3 +- ...el_dashboard_list_delete_items_response.go | 3 +- api/datadogV2/model_dashboard_list_item.go | 31 +-- .../model_dashboard_list_item_request.go | 29 +-- .../model_dashboard_list_item_response.go | 29 +-- api/datadogV2/model_dashboard_list_items.go | 22 +- ...del_dashboard_list_update_items_request.go | 3 +- ...el_dashboard_list_update_items_response.go | 3 +- api/datadogV2/model_data_scalar_column.go | 3 +- api/datadogV2/model_detailed_finding.go | 3 +- .../model_detailed_finding_attributes.go | 3 +- api/datadogV2/model_event.go | 3 +- api/datadogV2/model_event_attributes.go | 3 +- api/datadogV2/model_event_response.go | 3 +- .../model_event_response_attributes.go | 3 +- api/datadogV2/model_events_compute.go | 24 +-- api/datadogV2/model_events_group_by.go | 20 +- api/datadogV2/model_events_group_by_sort.go | 26 +-- api/datadogV2/model_events_list_request.go | 3 +- api/datadogV2/model_events_list_response.go | 3 +- .../model_events_list_response_links.go | 3 +- api/datadogV2/model_events_query_filter.go | 3 +- api/datadogV2/model_events_query_options.go | 3 +- api/datadogV2/model_events_request_page.go | 3 +- .../model_events_response_metadata.go | 3 +- .../model_events_response_metadata_page.go | 3 +- api/datadogV2/model_events_scalar_query.go | 37 ++-- api/datadogV2/model_events_search.go | 3 +- .../model_events_timeseries_query.go | 37 ++-- api/datadogV2/model_events_warning.go | 3 +- ...model_fastly_accoun_response_attributes.go | 20 +- .../model_fastly_account_create_request.go | 20 +- ...astly_account_create_request_attributes.go | 31 +-- ...odel_fastly_account_create_request_data.go | 29 +-- .../model_fastly_account_response.go | 3 +- .../model_fastly_account_response_data.go | 38 ++-- .../model_fastly_account_update_request.go | 20 +- ...astly_account_update_request_attributes.go | 3 +- ...odel_fastly_account_update_request_data.go | 3 +- .../model_fastly_accounts_response.go | 3 +- api/datadogV2/model_fastly_service.go | 20 +- .../model_fastly_service_attributes.go | 3 +- api/datadogV2/model_fastly_service_data.go | 31 +-- api/datadogV2/model_fastly_service_request.go | 20 +- .../model_fastly_service_response.go | 3 +- .../model_fastly_services_response.go | 3 +- api/datadogV2/model_finding.go | 3 +- api/datadogV2/model_finding_attributes.go | 3 +- api/datadogV2/model_finding_mute.go | 3 +- api/datadogV2/model_finding_rule.go | 3 +- api/datadogV2/model_formula_limit.go | 3 +- api/datadogV2/model_full_api_key.go | 3 +- .../model_full_api_key_attributes.go | 3 +- api/datadogV2/model_full_application_key.go | 3 +- .../model_full_application_key_attributes.go | 3 +- .../model_gcp_service_account_meta.go | 3 +- .../model_gcpsts_delegate_account.go | 3 +- ...odel_gcpsts_delegate_account_attributes.go | 3 +- .../model_gcpsts_delegate_account_response.go | 3 +- api/datadogV2/model_gcpsts_service_account.go | 3 +- ...model_gcpsts_service_account_attributes.go | 3 +- ...l_gcpsts_service_account_create_request.go | 3 +- .../model_gcpsts_service_account_data.go | 3 +- .../model_gcpsts_service_account_response.go | 3 +- ...l_gcpsts_service_account_update_request.go | 3 +- ...sts_service_account_update_request_data.go | 3 +- .../model_gcpsts_service_accounts_response.go | 3 +- api/datadogV2/model_get_finding_response.go | 20 +- api/datadogV2/model_group_scalar_column.go | 3 +- api/datadogV2/model_hourly_usage.go | 3 +- .../model_hourly_usage_attributes.go | 3 +- .../model_hourly_usage_measurement.go | 3 +- api/datadogV2/model_hourly_usage_metadata.go | 3 +- .../model_hourly_usage_pagination.go | 3 +- api/datadogV2/model_hourly_usage_response.go | 3 +- api/datadogV2/model_http_log_error.go | 3 +- api/datadogV2/model_http_log_errors.go | 3 +- api/datadogV2/model_http_log_item.go | 20 +- api/datadogV2/model_httpci_app_error.go | 3 +- api/datadogV2/model_httpci_app_errors.go | 3 +- .../model_id_p_metadata_form_data.go | 3 +- .../model_incident_attachment_data.go | 43 ++-- ...del_incident_attachment_link_attributes.go | 29 +-- ...hment_link_attributes_attachment_object.go | 29 +-- ...cident_attachment_postmortem_attributes.go | 29 +-- ...model_incident_attachment_relationships.go | 3 +- .../model_incident_attachment_update_data.go | 20 +- ...odel_incident_attachment_update_request.go | 20 +- ...del_incident_attachment_update_response.go | 20 +- ...postmortem_attributes_attachment_object.go | 29 +-- .../model_incident_attachments_response.go | 20 +- .../model_incident_create_attributes.go | 31 +-- api/datadogV2/model_incident_create_data.go | 31 +-- .../model_incident_create_relationships.go | 20 +- .../model_incident_create_request.go | 20 +- ...ncident_field_attributes_multiple_value.go | 3 +- ..._incident_field_attributes_single_value.go | 3 +- ...ncident_integration_metadata_attributes.go | 33 ++- ...cident_integration_metadata_create_data.go | 29 +-- ...ent_integration_metadata_create_request.go | 20 +- ...dent_integration_metadata_list_response.go | 20 +- ...ncident_integration_metadata_patch_data.go | 29 +-- ...dent_integration_metadata_patch_request.go | 20 +- ..._incident_integration_metadata_response.go | 20 +- ...dent_integration_metadata_response_data.go | 31 +-- .../model_incident_notification_handle.go | 3 +- api/datadogV2/model_incident_response.go | 20 +- .../model_incident_response_attributes.go | 20 +- api/datadogV2/model_incident_response_data.go | 31 +-- api/datadogV2/model_incident_response_meta.go | 3 +- ...model_incident_response_meta_pagination.go | 3 +- .../model_incident_response_relationships.go | 3 +- .../model_incident_search_response.go | 20 +- ...del_incident_search_response_attributes.go | 38 ++-- .../model_incident_search_response_data.go | 3 +- ...el_incident_search_response_facets_data.go | 3 +- ...cident_search_response_field_facet_data.go | 3 +- ...incident_search_response_incidents_data.go | 20 +- .../model_incident_search_response_meta.go | 3 +- ...dent_search_response_numeric_facet_data.go | 29 +-- ..._response_numeric_facet_data_aggregates.go | 3 +- ...arch_response_property_field_facet_data.go | 31 +-- ...ncident_search_response_user_facet_data.go | 3 +- ...odel_incident_service_create_attributes.go | 20 +- .../model_incident_service_create_data.go | 20 +- .../model_incident_service_create_request.go | 20 +- .../model_incident_service_relationships.go | 3 +- .../model_incident_service_response.go | 20 +- ...el_incident_service_response_attributes.go | 3 +- .../model_incident_service_response_data.go | 31 +-- ...odel_incident_service_update_attributes.go | 20 +- .../model_incident_service_update_data.go | 20 +- .../model_incident_service_update_request.go | 20 +- .../model_incident_services_response.go | 20 +- .../model_incident_team_create_attributes.go | 20 +- .../model_incident_team_create_data.go | 20 +- .../model_incident_team_create_request.go | 20 +- .../model_incident_team_relationships.go | 3 +- api/datadogV2/model_incident_team_response.go | 20 +- ...model_incident_team_response_attributes.go | 3 +- .../model_incident_team_response_data.go | 3 +- .../model_incident_team_update_attributes.go | 20 +- .../model_incident_team_update_data.go | 20 +- .../model_incident_team_update_request.go | 20 +- .../model_incident_teams_response.go | 20 +- ...imeline_cell_markdown_create_attributes.go | 33 ++- ...cell_markdown_create_attributes_content.go | 3 +- .../model_incident_todo_anonymous_assignee.go | 43 ++-- .../model_incident_todo_attributes.go | 37 ++-- .../model_incident_todo_create_data.go | 29 +-- .../model_incident_todo_create_request.go | 20 +- .../model_incident_todo_list_response.go | 20 +- .../model_incident_todo_patch_data.go | 29 +-- .../model_incident_todo_patch_request.go | 20 +- api/datadogV2/model_incident_todo_response.go | 20 +- .../model_incident_todo_response_data.go | 31 +-- .../model_incident_update_attributes.go | 3 +- api/datadogV2/model_incident_update_data.go | 31 +-- .../model_incident_update_relationships.go | 3 +- .../model_incident_update_request.go | 20 +- api/datadogV2/model_incidents_response.go | 20 +- .../model_intake_payload_accepted.go | 3 +- .../model_ip_allowlist_attributes.go | 3 +- api/datadogV2/model_ip_allowlist_data.go | 20 +- api/datadogV2/model_ip_allowlist_entry.go | 20 +- .../model_ip_allowlist_entry_attributes.go | 3 +- .../model_ip_allowlist_entry_data.go | 20 +- api/datadogV2/model_ip_allowlist_response.go | 3 +- .../model_ip_allowlist_update_request.go | 20 +- .../model_jira_integration_metadata.go | 20 +- ...l_jira_integration_metadata_issues_item.go | 31 +-- api/datadogV2/model_jsonapi_error_item.go | 3 +- api/datadogV2/model_jsonapi_error_response.go | 20 +- .../model_list_application_keys_response.go | 3 +- api/datadogV2/model_list_findings_meta.go | 3 +- api/datadogV2/model_list_findings_page.go | 3 +- api/datadogV2/model_list_findings_response.go | 29 +-- api/datadogV2/model_log.go | 3 +- api/datadogV2/model_log_attributes.go | 3 +- api/datadogV2/model_logs_aggregate_bucket.go | 3 +- ...aggregate_bucket_value_timeseries_point.go | 3 +- api/datadogV2/model_logs_aggregate_request.go | 3 +- .../model_logs_aggregate_request_page.go | 3 +- .../model_logs_aggregate_response.go | 3 +- .../model_logs_aggregate_response_data.go | 3 +- api/datadogV2/model_logs_aggregate_sort.go | 3 +- api/datadogV2/model_logs_archive.go | 3 +- .../model_logs_archive_attributes.go | 38 ++-- .../model_logs_archive_create_request.go | 3 +- ..._logs_archive_create_request_attributes.go | 48 ++--- ..._logs_archive_create_request_definition.go | 20 +- .../model_logs_archive_definition.go | 20 +- .../model_logs_archive_destination_azure.go | 47 ++--- .../model_logs_archive_destination_gcs.go | 40 ++-- .../model_logs_archive_destination_s3.go | 40 ++-- .../model_logs_archive_integration_azure.go | 29 +-- .../model_logs_archive_integration_gcs.go | 29 +-- .../model_logs_archive_integration_s3.go | 29 +-- api/datadogV2/model_logs_archive_order.go | 3 +- .../model_logs_archive_order_attributes.go | 20 +- .../model_logs_archive_order_definition.go | 29 +-- api/datadogV2/model_logs_archives.go | 3 +- api/datadogV2/model_logs_compute.go | 26 +-- api/datadogV2/model_logs_group_by.go | 20 +- .../model_logs_group_by_histogram.go | 38 ++-- api/datadogV2/model_logs_list_request.go | 3 +- api/datadogV2/model_logs_list_request_page.go | 3 +- api/datadogV2/model_logs_list_response.go | 3 +- .../model_logs_list_response_links.go | 3 +- api/datadogV2/model_logs_metric_compute.go | 24 +-- .../model_logs_metric_create_attributes.go | 20 +- .../model_logs_metric_create_data.go | 38 ++-- .../model_logs_metric_create_request.go | 20 +- api/datadogV2/model_logs_metric_filter.go | 3 +- api/datadogV2/model_logs_metric_group_by.go | 20 +- api/datadogV2/model_logs_metric_response.go | 3 +- .../model_logs_metric_response_attributes.go | 3 +- .../model_logs_metric_response_compute.go | 3 +- .../model_logs_metric_response_data.go | 3 +- .../model_logs_metric_response_filter.go | 3 +- .../model_logs_metric_response_group_by.go | 3 +- .../model_logs_metric_update_attributes.go | 3 +- .../model_logs_metric_update_compute.go | 3 +- .../model_logs_metric_update_data.go | 29 +-- .../model_logs_metric_update_request.go | 20 +- api/datadogV2/model_logs_metrics_response.go | 3 +- api/datadogV2/model_logs_query_filter.go | 3 +- api/datadogV2/model_logs_query_options.go | 3 +- api/datadogV2/model_logs_response_metadata.go | 3 +- .../model_logs_response_metadata_page.go | 3 +- api/datadogV2/model_logs_warning.go | 3 +- api/datadogV2/model_metric.go | 3 +- api/datadogV2/model_metric_all_tags.go | 3 +- .../model_metric_all_tags_attributes.go | 3 +- .../model_metric_all_tags_response.go | 3 +- .../model_metric_bulk_tag_config_create.go | 31 +-- ...etric_bulk_tag_config_create_attributes.go | 3 +- ...l_metric_bulk_tag_config_create_request.go | 20 +- .../model_metric_bulk_tag_config_delete.go | 31 +-- ...etric_bulk_tag_config_delete_attributes.go | 3 +- ...l_metric_bulk_tag_config_delete_request.go | 20 +- .../model_metric_bulk_tag_config_response.go | 3 +- .../model_metric_bulk_tag_config_status.go | 31 +-- ...etric_bulk_tag_config_status_attributes.go | 3 +- .../model_metric_custom_aggregation.go | 29 +-- api/datadogV2/model_metric_distinct_volume.go | 3 +- ...model_metric_distinct_volume_attributes.go | 3 +- api/datadogV2/model_metric_estimate.go | 3 +- .../model_metric_estimate_attributes.go | 3 +- .../model_metric_estimate_response.go | 3 +- .../model_metric_ingested_indexed_volume.go | 3 +- ...tric_ingested_indexed_volume_attributes.go | 3 +- api/datadogV2/model_metric_metadata.go | 3 +- api/datadogV2/model_metric_origin.go | 3 +- api/datadogV2/model_metric_payload.go | 20 +- api/datadogV2/model_metric_point.go | 3 +- api/datadogV2/model_metric_resource.go | 3 +- api/datadogV2/model_metric_series.go | 31 +-- ..._metric_suggested_tags_and_aggregations.go | 3 +- ...uggested_tags_and_aggregations_response.go | 3 +- .../model_metric_suggested_tags_attributes.go | 3 +- .../model_metric_tag_configuration.go | 3 +- ...del_metric_tag_configuration_attributes.go | 3 +- ...ric_tag_configuration_create_attributes.go | 35 ++-- ...el_metric_tag_configuration_create_data.go | 31 +-- ...metric_tag_configuration_create_request.go | 20 +- ...model_metric_tag_configuration_response.go | 3 +- ...ric_tag_configuration_update_attributes.go | 3 +- ...el_metric_tag_configuration_update_data.go | 31 +-- ...metric_tag_configuration_update_request.go | 20 +- .../model_metric_volumes_response.go | 3 +- ..._and_metric_tag_configurations_response.go | 3 +- api/datadogV2/model_metrics_scalar_query.go | 40 ++-- .../model_metrics_timeseries_query.go | 31 +-- ..._config_policy_attribute_create_request.go | 29 +-- ...or_config_policy_attribute_edit_request.go | 29 +-- ...onitor_config_policy_attribute_response.go | 3 +- ...model_monitor_config_policy_create_data.go | 29 +-- ...el_monitor_config_policy_create_request.go | 20 +- .../model_monitor_config_policy_edit_data.go | 38 ++-- ...odel_monitor_config_policy_edit_request.go | 20 +- ...del_monitor_config_policy_list_response.go | 3 +- .../model_monitor_config_policy_response.go | 3 +- ...del_monitor_config_policy_response_data.go | 3 +- .../model_monitor_config_policy_tag_policy.go | 3 +- ...config_policy_tag_policy_create_request.go | 38 ++-- api/datadogV2/model_monitor_type.go | 3 +- api/datadogV2/model_mute_finding_request.go | 20 +- .../model_mute_finding_request_attributes.go | 20 +- .../model_mute_finding_request_data.go | 38 ++-- .../model_mute_finding_request_properties.go | 35 ++-- api/datadogV2/model_mute_finding_response.go | 20 +- .../model_mute_finding_response_attributes.go | 3 +- .../model_mute_finding_response_data.go | 3 +- .../model_mute_finding_response_properties.go | 3 +- .../model_nullable_relationship_to_user.go | 16 +- ...odel_nullable_relationship_to_user_data.go | 29 +-- .../model_on_demand_concurrency_cap.go | 3 +- ...el_on_demand_concurrency_cap_attributes.go | 3 +- ...odel_on_demand_concurrency_cap_response.go | 3 +- ...odel_opsgenie_service_create_attributes.go | 40 ++-- .../model_opsgenie_service_create_data.go | 29 +-- .../model_opsgenie_service_create_request.go | 20 +- .../model_opsgenie_service_response.go | 20 +- ...el_opsgenie_service_response_attributes.go | 3 +- .../model_opsgenie_service_response_data.go | 38 ++-- ...odel_opsgenie_service_update_attributes.go | 3 +- .../model_opsgenie_service_update_data.go | 38 ++-- .../model_opsgenie_service_update_request.go | 20 +- .../model_opsgenie_services_response.go | 20 +- api/datadogV2/model_organization.go | 20 +- .../model_organization_attributes.go | 3 +- api/datadogV2/model_pagination.go | 3 +- api/datadogV2/model_partial_api_key.go | 3 +- .../model_partial_api_key_attributes.go | 3 +- .../model_partial_application_key.go | 3 +- ...odel_partial_application_key_attributes.go | 3 +- .../model_partial_application_key_response.go | 3 +- api/datadogV2/model_permission.go | 20 +- api/datadogV2/model_permission_attributes.go | 3 +- api/datadogV2/model_permissions_response.go | 3 +- api/datadogV2/model_process_summaries_meta.go | 3 +- .../model_process_summaries_meta_page.go | 3 +- .../model_process_summaries_response.go | 3 +- api/datadogV2/model_process_summary.go | 3 +- .../model_process_summary_attributes.go | 3 +- api/datadogV2/model_query_formula.go | 20 +- ...del_relationship_to_incident_attachment.go | 20 +- ...elationship_to_incident_attachment_data.go | 29 +-- ...p_to_incident_integration_metadata_data.go | 29 +-- ...nship_to_incident_integration_metadatas.go | 20 +- ...del_relationship_to_incident_postmortem.go | 20 +- ...elationship_to_incident_postmortem_data.go | 29 +-- .../model_relationship_to_organization.go | 20 +- ...model_relationship_to_organization_data.go | 29 +-- .../model_relationship_to_organizations.go | 20 +- .../model_relationship_to_permission.go | 3 +- .../model_relationship_to_permission_data.go | 3 +- .../model_relationship_to_permissions.go | 3 +- api/datadogV2/model_relationship_to_role.go | 3 +- .../model_relationship_to_role_data.go | 3 +- api/datadogV2/model_relationship_to_roles.go | 3 +- ...elationship_to_saml_assertion_attribute.go | 20 +- ...onship_to_saml_assertion_attribute_data.go | 29 +-- .../model_relationship_to_team_link_data.go | 29 +-- .../model_relationship_to_team_links.go | 3 +- api/datadogV2/model_relationship_to_user.go | 20 +- .../model_relationship_to_user_data.go | 29 +-- ...el_relationship_to_user_team_permission.go | 3 +- ...lationship_to_user_team_permission_data.go | 29 +-- .../model_relationship_to_user_team_user.go | 20 +- ...del_relationship_to_user_team_user_data.go | 29 +-- api/datadogV2/model_relationship_to_users.go | 20 +- .../model_response_meta_attributes.go | 3 +- api/datadogV2/model_restriction_policy.go | 38 ++-- .../model_restriction_policy_attributes.go | 20 +- .../model_restriction_policy_binding.go | 29 +-- .../model_restriction_policy_response.go | 20 +- ...model_restriction_policy_update_request.go | 20 +- api/datadogV2/model_role.go | 20 +- api/datadogV2/model_role_attributes.go | 3 +- api/datadogV2/model_role_clone.go | 29 +-- api/datadogV2/model_role_clone_attributes.go | 20 +- api/datadogV2/model_role_clone_request.go | 20 +- api/datadogV2/model_role_create_attributes.go | 20 +- api/datadogV2/model_role_create_data.go | 24 +-- api/datadogV2/model_role_create_request.go | 20 +- api/datadogV2/model_role_create_response.go | 3 +- .../model_role_create_response_data.go | 20 +- api/datadogV2/model_role_relationships.go | 3 +- api/datadogV2/model_role_response.go | 3 +- .../model_role_response_relationships.go | 3 +- api/datadogV2/model_role_update_attributes.go | 3 +- api/datadogV2/model_role_update_data.go | 44 ++-- api/datadogV2/model_role_update_request.go | 20 +- api/datadogV2/model_role_update_response.go | 3 +- .../model_role_update_response_data.go | 20 +- api/datadogV2/model_roles_response.go | 3 +- ...aggregate_bucket_value_timeseries_point.go | 3 +- api/datadogV2/model_rum_aggregate_request.go | 3 +- api/datadogV2/model_rum_aggregate_sort.go | 3 +- .../model_rum_aggregation_buckets_response.go | 3 +- .../model_rum_analytics_aggregate_response.go | 3 +- api/datadogV2/model_rum_application.go | 38 ++-- .../model_rum_application_attributes.go | 72 +++---- api/datadogV2/model_rum_application_create.go | 29 +-- ...model_rum_application_create_attributes.go | 20 +- .../model_rum_application_create_request.go | 20 +- api/datadogV2/model_rum_application_list.go | 29 +-- .../model_rum_application_list_attributes.go | 67 +++--- .../model_rum_application_response.go | 3 +- api/datadogV2/model_rum_application_update.go | 31 +-- ...model_rum_application_update_attributes.go | 3 +- .../model_rum_application_update_request.go | 20 +- .../model_rum_applications_response.go | 3 +- api/datadogV2/model_rum_bucket_response.go | 3 +- api/datadogV2/model_rum_compute.go | 26 +-- api/datadogV2/model_rum_event.go | 3 +- api/datadogV2/model_rum_event_attributes.go | 3 +- api/datadogV2/model_rum_events_response.go | 3 +- api/datadogV2/model_rum_group_by.go | 20 +- api/datadogV2/model_rum_group_by_histogram.go | 38 ++-- api/datadogV2/model_rum_query_filter.go | 3 +- api/datadogV2/model_rum_query_options.go | 3 +- api/datadogV2/model_rum_query_page_options.go | 3 +- api/datadogV2/model_rum_response_links.go | 3 +- api/datadogV2/model_rum_response_metadata.go | 3 +- api/datadogV2/model_rum_response_page.go | 3 +- .../model_rum_search_events_request.go | 3 +- api/datadogV2/model_rum_warning.go | 3 +- .../model_saml_assertion_attribute.go | 31 +-- ...del_saml_assertion_attribute_attributes.go | 3 +- .../model_scalar_formula_query_request.go | 20 +- .../model_scalar_formula_query_response.go | 3 +- api/datadogV2/model_scalar_formula_request.go | 29 +-- ...model_scalar_formula_request_attributes.go | 42 ++-- ...odel_scalar_formula_response_atrributes.go | 3 +- api/datadogV2/model_scalar_meta.go | 3 +- api/datadogV2/model_scalar_response.go | 3 +- api/datadogV2/model_security_filter.go | 3 +- .../model_security_filter_attributes.go | 3 +- ...model_security_filter_create_attributes.go | 48 ++--- .../model_security_filter_create_data.go | 29 +-- .../model_security_filter_create_request.go | 20 +- .../model_security_filter_exclusion_filter.go | 29 +-- ...curity_filter_exclusion_filter_response.go | 3 +- api/datadogV2/model_security_filter_meta.go | 3 +- .../model_security_filter_response.go | 3 +- ...model_security_filter_update_attributes.go | 3 +- .../model_security_filter_update_data.go | 29 +-- .../model_security_filter_update_request.go | 20 +- .../model_security_filters_response.go | 3 +- .../model_security_monitoring_filter.go | 3 +- ...security_monitoring_list_rules_response.go | 3 +- .../model_security_monitoring_rule_case.go | 3 +- ...el_security_monitoring_rule_case_create.go | 26 +-- ...nitoring_rule_impossible_travel_options.go | 3 +- ...urity_monitoring_rule_new_value_options.go | 3 +- .../model_security_monitoring_rule_options.go | 3 +- ...security_monitoring_rule_update_payload.go | 3 +- .../model_security_monitoring_signal.go | 3 +- ...oring_signal_assignee_update_attributes.go | 22 +- ..._monitoring_signal_assignee_update_data.go | 20 +- ...nitoring_signal_assignee_update_request.go | 20 +- ...l_security_monitoring_signal_attributes.go | 3 +- ...ring_signal_incidents_update_attributes.go | 22 +- ...monitoring_signal_incidents_update_data.go | 20 +- ...itoring_signal_incidents_update_request.go | 20 +- ...security_monitoring_signal_list_request.go | 3 +- ...y_monitoring_signal_list_request_filter.go | 3 +- ...ity_monitoring_signal_list_request_page.go | 3 +- ...y_monitoring_signal_rule_create_payload.go | 71 +++---- ...l_security_monitoring_signal_rule_query.go | 20 +- ...ecurity_monitoring_signal_rule_response.go | 3 +- ...y_monitoring_signal_rule_response_query.go | 3 +- ...nitoring_signal_state_update_attributes.go | 20 +- ...ity_monitoring_signal_state_update_data.go | 20 +- ..._monitoring_signal_state_update_request.go | 20 +- ...ity_monitoring_signal_triage_attributes.go | 42 ++-- ...ty_monitoring_signal_triage_update_data.go | 3 +- ...onitoring_signal_triage_update_response.go | 20 +- ...curity_monitoring_signals_list_response.go | 3 +- ..._monitoring_signals_list_response_links.go | 3 +- ...y_monitoring_signals_list_response_meta.go | 3 +- ...itoring_signals_list_response_meta_page.go | 3 +- ...monitoring_standard_rule_create_payload.go | 71 +++---- ...security_monitoring_standard_rule_query.go | 20 +- ...urity_monitoring_standard_rule_response.go | 3 +- .../model_security_monitoring_triage_user.go | 20 +- ...l_sensitive_data_scanner_config_request.go | 29 +-- ...el_sensitive_data_scanner_configuration.go | 3 +- ...nsitive_data_scanner_configuration_data.go | 3 +- ...ata_scanner_configuration_relationships.go | 3 +- ...tive_data_scanner_create_group_response.go | 3 +- ...itive_data_scanner_create_rule_response.go | 3 +- .../model_sensitive_data_scanner_filter.go | 3 +- ...sitive_data_scanner_get_config_response.go | 3 +- ...e_data_scanner_get_config_response_data.go | 3 +- .../model_sensitive_data_scanner_group.go | 3 +- ...sensitive_data_scanner_group_attributes.go | 3 +- ...del_sensitive_data_scanner_group_create.go | 31 +-- ...itive_data_scanner_group_create_request.go | 3 +- ...model_sensitive_data_scanner_group_data.go | 3 +- ...itive_data_scanner_group_delete_request.go | 20 +- ...tive_data_scanner_group_delete_response.go | 3 +- ...sitive_data_scanner_group_included_item.go | 3 +- ...model_sensitive_data_scanner_group_item.go | 3 +- ...model_sensitive_data_scanner_group_list.go | 3 +- ...sitive_data_scanner_group_relationships.go | 3 +- ...l_sensitive_data_scanner_group_response.go | 3 +- ...del_sensitive_data_scanner_group_update.go | 3 +- ...itive_data_scanner_group_update_request.go | 29 +-- ...tive_data_scanner_group_update_response.go | 3 +- .../model_sensitive_data_scanner_meta.go | 3 +- ...ensitive_data_scanner_meta_version_only.go | 3 +- ...l_sensitive_data_scanner_reorder_config.go | 3 +- ...ve_data_scanner_reorder_groups_response.go | 3 +- .../model_sensitive_data_scanner_rule.go | 3 +- ..._sensitive_data_scanner_rule_attributes.go | 3 +- ...odel_sensitive_data_scanner_rule_create.go | 38 ++-- ...sitive_data_scanner_rule_create_request.go | 29 +-- .../model_sensitive_data_scanner_rule_data.go | 3 +- ...sitive_data_scanner_rule_delete_request.go | 20 +- ...itive_data_scanner_rule_delete_response.go | 3 +- ...nsitive_data_scanner_rule_included_item.go | 3 +- ...nsitive_data_scanner_rule_relationships.go | 3 +- ...el_sensitive_data_scanner_rule_response.go | 3 +- ...odel_sensitive_data_scanner_rule_update.go | 3 +- ...sitive_data_scanner_rule_update_request.go | 29 +-- ...itive_data_scanner_rule_update_response.go | 3 +- ...sensitive_data_scanner_standard_pattern.go | 3 +- ...ata_scanner_standard_pattern_attributes.go | 3 +- ...tive_data_scanner_standard_pattern_data.go | 3 +- ...scanner_standard_patterns_response_data.go | 3 +- ...scanner_standard_patterns_response_item.go | 3 +- ...sensitive_data_scanner_text_replacement.go | 3 +- ...model_service_account_create_attributes.go | 31 +-- .../model_service_account_create_data.go | 33 ++- .../model_service_account_create_request.go | 20 +- ...odel_service_definition_create_response.go | 3 +- .../model_service_definition_data.go | 3 +- ...odel_service_definition_data_attributes.go | 3 +- .../model_service_definition_get_response.go | 3 +- .../model_service_definition_meta.go | 3 +- api/datadogV2/model_service_definition_v1.go | 31 +-- .../model_service_definition_v1_contact.go | 3 +- .../model_service_definition_v1_info.go | 20 +- ...odel_service_definition_v1_integrations.go | 3 +- .../model_service_definition_v1_org.go | 3 +- .../model_service_definition_v1_resource.go | 38 ++-- api/datadogV2/model_service_definition_v2.go | 31 +-- .../model_service_definition_v2_doc.go | 31 +-- .../model_service_definition_v2_dot1.go | 31 +-- .../model_service_definition_v2_dot1_email.go | 31 +-- ...service_definition_v2_dot1_integrations.go | 3 +- .../model_service_definition_v2_dot1_link.go | 44 ++-- ...del_service_definition_v2_dot1_ms_teams.go | 31 +-- ...del_service_definition_v2_dot1_opsgenie.go | 20 +- ...el_service_definition_v2_dot1_pagerduty.go | 3 +- .../model_service_definition_v2_dot1_slack.go | 31 +-- .../model_service_definition_v2_email.go | 31 +-- ...odel_service_definition_v2_integrations.go | 3 +- .../model_service_definition_v2_link.go | 38 ++-- .../model_service_definition_v2_ms_teams.go | 31 +-- .../model_service_definition_v2_opsgenie.go | 20 +- .../model_service_definition_v2_repo.go | 31 +-- .../model_service_definition_v2_slack.go | 31 +-- ...model_service_definitions_list_response.go | 3 +- .../model_slack_integration_metadata.go | 20 +- ...slack_integration_metadata_channel_item.go | 38 ++-- api/datadogV2/model_spans_metric_compute.go | 24 +-- .../model_spans_metric_create_attributes.go | 20 +- .../model_spans_metric_create_data.go | 38 ++-- .../model_spans_metric_create_request.go | 20 +- api/datadogV2/model_spans_metric_filter.go | 3 +- api/datadogV2/model_spans_metric_group_by.go | 20 +- api/datadogV2/model_spans_metric_response.go | 3 +- .../model_spans_metric_response_attributes.go | 3 +- .../model_spans_metric_response_compute.go | 3 +- .../model_spans_metric_response_data.go | 3 +- .../model_spans_metric_response_filter.go | 3 +- .../model_spans_metric_response_group_by.go | 3 +- .../model_spans_metric_update_attributes.go | 3 +- .../model_spans_metric_update_compute.go | 3 +- .../model_spans_metric_update_data.go | 29 +-- .../model_spans_metric_update_request.go | 20 +- api/datadogV2/model_spans_metrics_response.go | 3 +- api/datadogV2/model_team.go | 42 ++-- api/datadogV2/model_team_attributes.go | 31 +-- api/datadogV2/model_team_create.go | 31 +-- api/datadogV2/model_team_create_attributes.go | 31 +-- .../model_team_create_relationships.go | 3 +- api/datadogV2/model_team_create_request.go | 20 +- api/datadogV2/model_team_data.go | 38 ++-- api/datadogV2/model_team_link.go | 38 ++-- api/datadogV2/model_team_link_attributes.go | 31 +-- api/datadogV2/model_team_link_create.go | 29 +-- .../model_team_link_create_request.go | 20 +- api/datadogV2/model_team_link_response.go | 3 +- api/datadogV2/model_team_links_response.go | 3 +- .../model_team_permission_setting.go | 31 +-- ...odel_team_permission_setting_attributes.go | 3 +- .../model_team_permission_setting_response.go | 3 +- .../model_team_permission_setting_update.go | 20 +- ...am_permission_setting_update_attributes.go | 3 +- ..._team_permission_setting_update_request.go | 20 +- ...model_team_permission_settings_response.go | 3 +- api/datadogV2/model_team_relationships.go | 3 +- api/datadogV2/model_team_response.go | 3 +- api/datadogV2/model_team_update.go | 31 +-- api/datadogV2/model_team_update_attributes.go | 31 +-- .../model_team_update_relationships.go | 3 +- api/datadogV2/model_team_update_request.go | 20 +- api/datadogV2/model_teams_response.go | 3 +- .../model_timeseries_formula_query_request.go | 20 +- ...model_timeseries_formula_query_response.go | 3 +- .../model_timeseries_formula_request.go | 29 +-- ...l_timeseries_formula_request_attributes.go | 46 ++--- api/datadogV2/model_timeseries_response.go | 3 +- .../model_timeseries_response_attributes.go | 3 +- .../model_timeseries_response_series.go | 3 +- api/datadogV2/model_unit.go | 3 +- ...pplication_security_monitoring_response.go | 3 +- .../model_usage_attributes_object.go | 3 +- api/datadogV2/model_usage_data_object.go | 3 +- ...sage_lambda_traced_invocations_response.go | 3 +- ..._usage_observability_pipelines_response.go | 3 +- .../model_usage_time_series_object.go | 3 +- api/datadogV2/model_user.go | 3 +- api/datadogV2/model_user_attributes.go | 3 +- api/datadogV2/model_user_create_attributes.go | 20 +- api/datadogV2/model_user_create_data.go | 33 ++- api/datadogV2/model_user_create_request.go | 20 +- api/datadogV2/model_user_invitation_data.go | 29 +-- .../model_user_invitation_data_attributes.go | 3 +- .../model_user_invitation_relationships.go | 20 +- .../model_user_invitation_response.go | 3 +- .../model_user_invitation_response_data.go | 3 +- .../model_user_invitations_request.go | 20 +- .../model_user_invitations_response.go | 3 +- api/datadogV2/model_user_relationships.go | 3 +- api/datadogV2/model_user_response.go | 3 +- .../model_user_response_relationships.go | 3 +- api/datadogV2/model_user_team.go | 31 +-- api/datadogV2/model_user_team_attributes.go | 3 +- api/datadogV2/model_user_team_create.go | 20 +- api/datadogV2/model_user_team_permission.go | 31 +-- .../model_user_team_permission_attributes.go | 3 +- .../model_user_team_relationships.go | 3 +- api/datadogV2/model_user_team_request.go | 20 +- api/datadogV2/model_user_team_response.go | 3 +- api/datadogV2/model_user_team_update.go | 20 +- .../model_user_team_update_request.go | 20 +- api/datadogV2/model_user_teams_response.go | 3 +- api/datadogV2/model_user_update_attributes.go | 3 +- api/datadogV2/model_user_update_data.go | 38 ++-- api/datadogV2/model_user_update_request.go | 20 +- api/datadogV2/model_users_response.go | 3 +- 1350 files changed, 7184 insertions(+), 12275 deletions(-) create mode 100644 api/datadogV2/model_ci_app_user_info.go diff --git a/.generator/poetry.lock b/.generator/poetry.lock index 31c26c17cc0..e0c4cbb513d 100644 --- a/.generator/poetry.lock +++ b/.generator/poetry.lock @@ -117,62 +117,62 @@ testing = ["pytest"] [[package]] name = "markupsafe" -version = "2.1.2" +version = "2.1.3" description = "Safely add untrusted strings to HTML/XML markup." category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:665a36ae6f8f20a4676b53224e33d456a6f5a72657d9c83c2aa00765072f31f7"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:340bea174e9761308703ae988e982005aedf427de816d1afe98147668cc03036"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22152d00bf4a9c7c83960521fc558f55a1adbc0631fbb00a9471e097b19d72e1"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:28057e985dace2f478e042eaa15606c7efccb700797660629da387eb289b9323"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca244fa73f50a800cf8c3ebf7fd93149ec37f5cb9596aa8873ae2c1d23498601"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d9d971ec1e79906046aa3ca266de79eac42f1dbf3612a05dc9368125952bd1a1"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:7e007132af78ea9df29495dbf7b5824cb71648d7133cf7848a2a5dd00d36f9ff"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7313ce6a199651c4ed9d7e4cfb4aa56fe923b1adf9af3b420ee14e6d9a73df65"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-win32.whl", hash = "sha256:c4a549890a45f57f1ebf99c067a4ad0cb423a05544accaf2b065246827ed9603"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:835fb5e38fd89328e9c81067fd642b3593c33e1e17e2fdbf77f5676abb14a156"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2ec4f2d48ae59bbb9d1f9d7efb9236ab81429a764dedca114f5fdabbc3788013"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:608e7073dfa9e38a85d38474c082d4281f4ce276ac0010224eaba11e929dd53a"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:65608c35bfb8a76763f37036547f7adfd09270fbdbf96608be2bead319728fcd"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2bfb563d0211ce16b63c7cb9395d2c682a23187f54c3d79bfec33e6705473c6"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da25303d91526aac3672ee6d49a2f3db2d9502a4a60b55519feb1a4c7714e07d"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:9cad97ab29dfc3f0249b483412c85c8ef4766d96cdf9dcf5a1e3caa3f3661cf1"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:085fd3201e7b12809f9e6e9bc1e5c96a368c8523fad5afb02afe3c051ae4afcc"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1bea30e9bf331f3fef67e0a3877b2288593c98a21ccb2cf29b74c581a4eb3af0"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-win32.whl", hash = "sha256:7df70907e00c970c60b9ef2938d894a9381f38e6b9db73c5be35e59d92e06625"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:e55e40ff0cc8cc5c07996915ad367fa47da6b3fc091fdadca7f5403239c5fec3"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a6e40afa7f45939ca356f348c8e23048e02cb109ced1eb8420961b2f40fb373a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cf877ab4ed6e302ec1d04952ca358b381a882fbd9d1b07cccbfd61783561f98a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:63ba06c9941e46fa389d389644e2d8225e0e3e5ebcc4ff1ea8506dce646f8c8a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f1cd098434e83e656abf198f103a8207a8187c0fc110306691a2e94a78d0abb2"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:55f44b440d491028addb3b88f72207d71eeebfb7b5dbf0643f7c023ae1fba619"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:a6f2fcca746e8d5910e18782f976489939d54a91f9411c32051b4aab2bd7c513"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0b462104ba25f1ac006fdab8b6a01ebbfbce9ed37fd37fd4acd70c67c973e460"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-win32.whl", hash = "sha256:7668b52e102d0ed87cb082380a7e2e1e78737ddecdde129acadb0eccc5423859"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-win_amd64.whl", hash = "sha256:6d6607f98fcf17e534162f0709aaad3ab7a96032723d8ac8750ffe17ae5a0666"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:a806db027852538d2ad7555b203300173dd1b77ba116de92da9afbc3a3be3eed"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a4abaec6ca3ad8660690236d11bfe28dfd707778e2442b45addd2f086d6ef094"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f03a532d7dee1bed20bc4884194a16160a2de9ffc6354b3878ec9682bb623c54"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4cf06cdc1dda95223e9d2d3c58d3b178aa5dacb35ee7e3bbac10e4e1faacb419"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:22731d79ed2eb25059ae3df1dfc9cb1546691cc41f4e3130fe6bfbc3ecbbecfa"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f8ffb705ffcf5ddd0e80b65ddf7bed7ee4f5a441ea7d3419e861a12eaf41af58"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8db032bf0ce9022a8e41a22598eefc802314e81b879ae093f36ce9ddf39ab1ba"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:2298c859cfc5463f1b64bd55cb3e602528db6fa0f3cfd568d3605c50678f8f03"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-win32.whl", hash = "sha256:50c42830a633fa0cf9e7d27664637532791bfc31c731a87b202d2d8ac40c3ea2"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-win_amd64.whl", hash = "sha256:bb06feb762bade6bf3c8b844462274db0c76acc95c52abe8dbed28ae3d44a147"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:99625a92da8229df6d44335e6fcc558a5037dd0a760e11d84be2260e6f37002f"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8bca7e26c1dd751236cfb0c6c72d4ad61d986e9a41bbf76cb445f69488b2a2bd"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40627dcf047dadb22cd25ea7ecfe9cbf3bbbad0482ee5920b582f3809c97654f"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40dfd3fefbef579ee058f139733ac336312663c6706d1163b82b3003fb1925c4"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:090376d812fb6ac5f171e5938e82e7f2d7adc2b629101cec0db8b267815c85e2"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:2e7821bffe00aa6bd07a23913b7f4e01328c3d5cc0b40b36c0bd81d362faeb65"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c0a33bc9f02c2b17c3ea382f91b4db0e6cde90b63b296422a939886a7a80de1c"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:b8526c6d437855442cdd3d87eede9c425c4445ea011ca38d937db299382e6fa3"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-win32.whl", hash = "sha256:137678c63c977754abe9086a3ec011e8fd985ab90631145dfb9294ad09c102a7"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-win_amd64.whl", hash = "sha256:0576fe974b40a400449768941d5d0858cc624e3249dfd1e0c33674e5c7ca7aed"}, - {file = "MarkupSafe-2.1.2.tar.gz", hash = "sha256:abcabc8c2b26036d62d4c746381a6f7cf60aafcc653198ad678306986b09450d"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win32.whl", hash = "sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl", hash = "sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win32.whl", hash = "sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win_amd64.whl", hash = "sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win32.whl", hash = "sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win_amd64.whl", hash = "sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win32.whl", hash = "sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win_amd64.whl", hash = "sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba"}, + {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] [[package]] @@ -189,13 +189,14 @@ files = [ [[package]] name = "parse" -version = "1.19.0" +version = "1.19.1" description = "parse() is the opposite of format()" category = "main" optional = false python-versions = "*" files = [ - {file = "parse-1.19.0.tar.gz", hash = "sha256:9ff82852bcb65d139813e2a5197627a94966245c897796760a3a2a8eb66f020b"}, + {file = "parse-1.19.1-py2.py3-none-any.whl", hash = "sha256:371ed3800dc63983832159cc9373156613947707bc448b5215473a219dbd4362"}, + {file = "parse-1.19.1.tar.gz", hash = "sha256:cc3a47236ff05da377617ddefa867b7ba983819c664e1afe46249e5b469be464"}, ] [[package]] @@ -220,14 +221,14 @@ docs = ["sphinx (>=1.2)"] [[package]] name = "pluggy" -version = "1.0.0" +version = "1.2.0" description = "plugin and hook calling mechanisms for python" category = "main" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, ] [package.extras] @@ -248,14 +249,14 @@ files = [ [[package]] name = "pytest" -version = "7.3.0" +version = "7.3.2" description = "pytest: simple powerful testing with Python" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "pytest-7.3.0-py3-none-any.whl", hash = "sha256:933051fa1bfbd38a21e73c3960cebdad4cf59483ddba7696c48509727e17f201"}, - {file = "pytest-7.3.0.tar.gz", hash = "sha256:58ecc27ebf0ea643ebfdf7fb1249335da761a00c9f955bcd922349bcb68ee57d"}, + {file = "pytest-7.3.2-py3-none-any.whl", hash = "sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295"}, + {file = "pytest-7.3.2.tar.gz", hash = "sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b"}, ] [package.dependencies] @@ -267,7 +268,7 @@ pluggy = ">=0.12,<2.0" tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-bdd" diff --git a/.generator/src/generator/templates/model_simple.j2 b/.generator/src/generator/templates/model_simple.j2 index 68c5ec45688..059b8778d1f 100644 --- a/.generator/src/generator/templates/model_simple.j2 +++ b/.generator/src/generator/templates/model_simple.j2 @@ -328,43 +328,18 @@ func (o *{{ name }}) UnmarshalJSON(bytes []byte) (err error) { {%- else %} func (o *{{ name }}) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - {%- for attr, spec in model.get("properties", {}).items() if attr in model.get("required", []) %} - {%- set propertyName = attr|attribute_name %} - {%- set dataType = get_type(spec, alternative_name=name + propertyName, render_nullable=True) %} - {%- if loop.first %} - required := struct { - {%- endif %} - {{ propertyName }} {% if not spec.nullable %}*{% endif %}{{ dataType }} `json:"{{ attr }}"` - {%- if loop.last %} - }{} - {%- endif %} - {%- endfor %} all := struct { {%- for attr, spec in model.get("properties", {}).items() %} {%- set propertyName = attr|attribute_name %} {%- set dataType = get_type(spec, alternative_name=name + propertyName, render_nullable=True) %} - {{ propertyName }} {% if model|is_reference(attr) %}*{% endif %}{{ dataType }} `json:"{{ attr }}{% if attr not in model.get("required", []) %},omitempty{% endif %}"` - {%- endfor %} - }{} - {#- unmarshal required properties #} - {%- for attr, spec in model.get("properties", {}).items() if attr in model.get("required", []) %} - {%- set propertyName = attr|attribute_name %} - {%- if loop.first %} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - {%- endif %} - {%- if not spec.nullable %} - if required.{{ propertyName }} == nil { + {%- if attr in model.get("required", []) %} + {{ propertyName }} {% if not spec.nullable %}*{% endif %}{{ dataType }} `json:"{{ attr }}"` {%- else %} - if !required.{{ propertyName }}.IsSet() { + {{ propertyName }} {% if model|is_reference(attr) %}*{% endif %}{{ dataType }} `json:"{{ attr }},omitempty"` {%- endif %} - return fmt.Errorf("required field {{ attr }} missing") - } {%- endfor %} - err = json.Unmarshal(bytes, &all) - if err != nil { + }{} + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -372,6 +347,16 @@ func (o *{{ name }}) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + {%- for attr, spec in model.get("properties", {}).items() if attr in model.get("required", []) %} + {%- set propertyName = attr|attribute_name %} + {%- if not spec.nullable %} + if all.{{ propertyName }} == nil { + {%- else %} + if !all.{{ propertyName }}.IsSet() { + {%- endif %} + return fmt.Errorf("required field {{ attr }} missing") + } + {%- endfor %} {%- if model.get("additionalProperties", True) %} additionalProperties := make(map[string]{{ get_type(model.get("additionalProperties", True)) }}) @@ -407,7 +392,11 @@ func (o *{{ name }}) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } {%- endif %} + {%- if attr in model.get("required", []) and not spec.nullable %} + o.{{ propertyName }} = *all.{{ propertyName }} + {%- else %} o.{{ propertyName }} = all.{{ propertyName }} + {%- endif %} {%- endfor %} {%- if model.get("additionalProperties", True) %} if len(additionalProperties) > 0 { diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8343ea3265d..eab5a887beb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,7 @@ repos: - id: generator name: generator language: python - entry: bash -c "cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../api/" + entry: bash -c "unset VIRTUAL_ENV && cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../api/" files: "^.generator/(config|schemas/v1|src|poetry.lock|pyproject.toml)" stages: [manual] pass_filenames: false @@ -51,7 +51,7 @@ repos: - id: examples name: examples language: python - entry: bash -c "cd .generator && poetry install && poetry run pytest" + entry: bash -c "unset VIRTUAL_ENV && cd .generator && poetry install && poetry run pytest" files: "^.generator/" stages: [manual] pass_filenames: false diff --git a/api/datadogV1/model_add_signal_to_incident_request.go b/api/datadogV1/model_add_signal_to_incident_request.go index 4bfbb9747ba..4e03aac5e80 100644 --- a/api/datadogV1/model_add_signal_to_incident_request.go +++ b/api/datadogV1/model_add_signal_to_incident_request.go @@ -144,23 +144,12 @@ func (o AddSignalToIncidentRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - IncidentId *int64 `json:"incident_id"` - }{} all := struct { AddToSignalTimeline *bool `json:"add_to_signal_timeline,omitempty"` - IncidentId int64 `json:"incident_id"` + IncidentId *int64 `json:"incident_id"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IncidentId == nil { - return fmt.Errorf("required field incident_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.IncidentId == nil { + return fmt.Errorf("required field incident_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"add_to_signal_timeline", "incident_id", "version"}) @@ -175,7 +167,7 @@ func (o *AddSignalToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { return err } o.AddToSignalTimeline = all.AddToSignalTimeline - o.IncidentId = all.IncidentId + o.IncidentId = *all.IncidentId o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_alert_graph_widget_definition.go b/api/datadogV1/model_alert_graph_widget_definition.go index 31809a07e77..91d1ac8118e 100644 --- a/api/datadogV1/model_alert_graph_widget_definition.go +++ b/api/datadogV1/model_alert_graph_widget_definition.go @@ -266,35 +266,16 @@ func (o AlertGraphWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - AlertId *string `json:"alert_id"` - Type *AlertGraphWidgetDefinitionType `json:"type"` - VizType *WidgetVizType `json:"viz_type"` - }{} all := struct { - AlertId string `json:"alert_id"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type AlertGraphWidgetDefinitionType `json:"type"` - VizType WidgetVizType `json:"viz_type"` + AlertId *string `json:"alert_id"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *AlertGraphWidgetDefinitionType `json:"type"` + VizType *WidgetVizType `json:"viz_type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AlertId == nil { - return fmt.Errorf("required field alert_id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.VizType == nil { - return fmt.Errorf("required field viz_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -302,6 +283,15 @@ func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AlertId == nil { + return fmt.Errorf("required field alert_id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.VizType == nil { + return fmt.Errorf("required field viz_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"alert_id", "time", "title", "title_align", "title_size", "type", "viz_type"}) @@ -332,7 +322,7 @@ func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.AlertId = all.AlertId + o.AlertId = *all.AlertId if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -344,8 +334,8 @@ func (o *AlertGraphWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type - o.VizType = all.VizType + o.Type = *all.Type + o.VizType = *all.VizType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_alert_value_widget_definition.go b/api/datadogV1/model_alert_value_widget_definition.go index 74e1399f7a0..531552eb5c9 100644 --- a/api/datadogV1/model_alert_value_widget_definition.go +++ b/api/datadogV1/model_alert_value_widget_definition.go @@ -305,32 +305,17 @@ func (o AlertValueWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - AlertId *string `json:"alert_id"` - Type *AlertValueWidgetDefinitionType `json:"type"` - }{} all := struct { - AlertId string `json:"alert_id"` - Precision *int64 `json:"precision,omitempty"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type AlertValueWidgetDefinitionType `json:"type"` - Unit *string `json:"unit,omitempty"` + AlertId *string `json:"alert_id"` + Precision *int64 `json:"precision,omitempty"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *AlertValueWidgetDefinitionType `json:"type"` + Unit *string `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AlertId == nil { - return fmt.Errorf("required field alert_id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -338,6 +323,12 @@ func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AlertId == nil { + return fmt.Errorf("required field alert_id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"alert_id", "precision", "text_align", "title", "title_align", "title_size", "type", "unit"}) @@ -368,13 +359,13 @@ func (o *AlertValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.AlertId = all.AlertId + o.AlertId = *all.AlertId o.Precision = all.Precision o.TextAlign = all.TextAlign o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type o.Unit = all.Unit if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_api_error_response.go b/api/datadogV1/model_api_error_response.go index edf638c9153..4b102bf0acf 100644 --- a/api/datadogV1/model_api_error_response.go +++ b/api/datadogV1/model_api_error_response.go @@ -78,21 +78,10 @@ func (o APIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Errors *[]string `json:"errors"` - }{} all := struct { - Errors []string `json:"errors"` + Errors *[]string `json:"errors"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Errors == nil { - return fmt.Errorf("required field errors missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Errors == nil { + return fmt.Errorf("required field errors missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"errors"}) } else { return err } - o.Errors = all.Errors + o.Errors = *all.Errors if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_api_key.go b/api/datadogV1/model_api_key.go index f53658d99ea..1859bdfba88 100644 --- a/api/datadogV1/model_api_key.go +++ b/api/datadogV1/model_api_key.go @@ -188,8 +188,7 @@ func (o *ApiKey) UnmarshalJSON(bytes []byte) (err error) { Key *string `json:"key,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_api_key_list_response.go b/api/datadogV1/model_api_key_list_response.go index e7d579807f6..bc62da772e0 100644 --- a/api/datadogV1/model_api_key_list_response.go +++ b/api/datadogV1/model_api_key_list_response.go @@ -86,8 +86,7 @@ func (o *ApiKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { ApiKeys []ApiKey `json:"api_keys,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_api_key_response.go b/api/datadogV1/model_api_key_response.go index 32770e70713..86686ed0e11 100644 --- a/api/datadogV1/model_api_key_response.go +++ b/api/datadogV1/model_api_key_response.go @@ -86,8 +86,7 @@ func (o *ApiKeyResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { ApiKey *ApiKey `json:"api_key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_apm_stats_query_column_type.go b/api/datadogV1/model_apm_stats_query_column_type.go index c6613762edf..2a8e8c5bdaf 100644 --- a/api/datadogV1/model_apm_stats_query_column_type.go +++ b/api/datadogV1/model_apm_stats_query_column_type.go @@ -177,24 +177,13 @@ func (o ApmStatsQueryColumnType) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Alias *string `json:"alias,omitempty"` CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Order *WidgetSort `json:"order,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +191,9 @@ func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"alias", "cell_display_mode", "name", "order"}) @@ -226,7 +218,7 @@ func (o *ApmStatsQueryColumnType) UnmarshalJSON(bytes []byte) (err error) { } o.Alias = all.Alias o.CellDisplayMode = all.CellDisplayMode - o.Name = all.Name + o.Name = *all.Name o.Order = all.Order if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_apm_stats_query_definition.go b/api/datadogV1/model_apm_stats_query_definition.go index a6acf45db0a..48312039fa8 100644 --- a/api/datadogV1/model_apm_stats_query_definition.go +++ b/api/datadogV1/model_apm_stats_query_definition.go @@ -252,50 +252,38 @@ func (o ApmStatsQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Env *string `json:"env"` - Name *string `json:"name"` - PrimaryTag *string `json:"primary_tag"` - RowType *ApmStatsQueryRowType `json:"row_type"` - Service *string `json:"service"` - }{} all := struct { Columns []ApmStatsQueryColumnType `json:"columns,omitempty"` - Env string `json:"env"` - Name string `json:"name"` - PrimaryTag string `json:"primary_tag"` + Env *string `json:"env"` + Name *string `json:"name"` + PrimaryTag *string `json:"primary_tag"` Resource *string `json:"resource,omitempty"` - RowType ApmStatsQueryRowType `json:"row_type"` - Service string `json:"service"` + RowType *ApmStatsQueryRowType `json:"row_type"` + Service *string `json:"service"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Env == nil { + if all.Env == nil { return fmt.Errorf("required field env missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.PrimaryTag == nil { + if all.PrimaryTag == nil { return fmt.Errorf("required field primary_tag missing") } - if required.RowType == nil { + if all.RowType == nil { return fmt.Errorf("required field row_type missing") } - if required.Service == nil { + if all.Service == nil { return fmt.Errorf("required field service missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"columns", "env", "name", "primary_tag", "resource", "row_type", "service"}) @@ -311,12 +299,12 @@ func (o *ApmStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Columns = all.Columns - o.Env = all.Env - o.Name = all.Name - o.PrimaryTag = all.PrimaryTag + o.Env = *all.Env + o.Name = *all.Name + o.PrimaryTag = *all.PrimaryTag o.Resource = all.Resource - o.RowType = all.RowType - o.Service = all.Service + o.RowType = *all.RowType + o.Service = *all.Service if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_application_key.go b/api/datadogV1/model_application_key.go index d11d8198b66..841f8ae3416 100644 --- a/api/datadogV1/model_application_key.go +++ b/api/datadogV1/model_application_key.go @@ -154,8 +154,7 @@ func (o *ApplicationKey) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Owner *string `json:"owner,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_application_key_list_response.go b/api/datadogV1/model_application_key_list_response.go index da2ef75a8fd..4b11f9bacbd 100644 --- a/api/datadogV1/model_application_key_list_response.go +++ b/api/datadogV1/model_application_key_list_response.go @@ -86,8 +86,7 @@ func (o *ApplicationKeyListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { ApplicationKeys []ApplicationKey `json:"application_keys,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_application_key_response.go b/api/datadogV1/model_application_key_response.go index a085ccf9ed1..5944f08526e 100644 --- a/api/datadogV1/model_application_key_response.go +++ b/api/datadogV1/model_application_key_response.go @@ -86,8 +86,7 @@ func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { ApplicationKey *ApplicationKey `json:"application_key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_authentication_validation_response.go b/api/datadogV1/model_authentication_validation_response.go index 116aaef2ed5..d5576c3cc9d 100644 --- a/api/datadogV1/model_authentication_validation_response.go +++ b/api/datadogV1/model_authentication_validation_response.go @@ -86,8 +86,7 @@ func (o *AuthenticationValidationResponse) UnmarshalJSON(bytes []byte) (err erro all := struct { Valid *bool `json:"valid,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_account.go b/api/datadogV1/model_aws_account.go index 3dbf2182307..7e0e6bf587a 100644 --- a/api/datadogV1/model_aws_account.go +++ b/api/datadogV1/model_aws_account.go @@ -446,8 +446,7 @@ func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) { RoleName *string `json:"role_name,omitempty"` SecretAccessKey *string `json:"secret_access_key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_account_and_lambda_request.go b/api/datadogV1/model_aws_account_and_lambda_request.go index f2f066ff676..b9ce18afd57 100644 --- a/api/datadogV1/model_aws_account_and_lambda_request.go +++ b/api/datadogV1/model_aws_account_and_lambda_request.go @@ -105,26 +105,11 @@ func (o AWSAccountAndLambdaRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSAccountAndLambdaRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { AccountId *string `json:"account_id"` LambdaArn *string `json:"lambda_arn"` }{} - all := struct { - AccountId string `json:"account_id"` - LambdaArn string `json:"lambda_arn"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccountId == nil { - return fmt.Errorf("required field account_id missing") - } - if required.LambdaArn == nil { - return fmt.Errorf("required field lambda_arn missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *AWSAccountAndLambdaRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AccountId == nil { + return fmt.Errorf("required field account_id missing") + } + if all.LambdaArn == nil { + return fmt.Errorf("required field lambda_arn missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "lambda_arn"}) } else { return err } - o.AccountId = all.AccountId - o.LambdaArn = all.LambdaArn + o.AccountId = *all.AccountId + o.LambdaArn = *all.LambdaArn if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_aws_account_create_response.go b/api/datadogV1/model_aws_account_create_response.go index e64a23bcfef..ddf29709925 100644 --- a/api/datadogV1/model_aws_account_create_response.go +++ b/api/datadogV1/model_aws_account_create_response.go @@ -86,8 +86,7 @@ func (o *AWSAccountCreateResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { ExternalId *string `json:"external_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_account_delete_request.go b/api/datadogV1/model_aws_account_delete_request.go index 832515f038e..81fa3c6b762 100644 --- a/api/datadogV1/model_aws_account_delete_request.go +++ b/api/datadogV1/model_aws_account_delete_request.go @@ -154,8 +154,7 @@ func (o *AWSAccountDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { AccountId *string `json:"account_id,omitempty"` RoleName *string `json:"role_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_account_list_response.go b/api/datadogV1/model_aws_account_list_response.go index 0891cf6734f..618f5ca8391 100644 --- a/api/datadogV1/model_aws_account_list_response.go +++ b/api/datadogV1/model_aws_account_list_response.go @@ -86,8 +86,7 @@ func (o *AWSAccountListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Accounts []AWSAccount `json:"accounts,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_logs_async_error.go b/api/datadogV1/model_aws_logs_async_error.go index d02178782a4..98852c4d471 100644 --- a/api/datadogV1/model_aws_logs_async_error.go +++ b/api/datadogV1/model_aws_logs_async_error.go @@ -120,8 +120,7 @@ func (o *AWSLogsAsyncError) UnmarshalJSON(bytes []byte) (err error) { Code *string `json:"code,omitempty"` Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_logs_async_response.go b/api/datadogV1/model_aws_logs_async_response.go index ded176bd444..31129476b05 100644 --- a/api/datadogV1/model_aws_logs_async_response.go +++ b/api/datadogV1/model_aws_logs_async_response.go @@ -120,8 +120,7 @@ func (o *AWSLogsAsyncResponse) UnmarshalJSON(bytes []byte) (err error) { Errors []AWSLogsAsyncError `json:"errors,omitempty"` Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_logs_lambda.go b/api/datadogV1/model_aws_logs_lambda.go index da3226ee5c1..c12bc8bc903 100644 --- a/api/datadogV1/model_aws_logs_lambda.go +++ b/api/datadogV1/model_aws_logs_lambda.go @@ -86,8 +86,7 @@ func (o *AWSLogsLambda) UnmarshalJSON(bytes []byte) (err error) { all := struct { Arn *string `json:"arn,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_logs_list_response.go b/api/datadogV1/model_aws_logs_list_response.go index 9cfdf314f2d..223a46ec07c 100644 --- a/api/datadogV1/model_aws_logs_list_response.go +++ b/api/datadogV1/model_aws_logs_list_response.go @@ -154,8 +154,7 @@ func (o *AWSLogsListResponse) UnmarshalJSON(bytes []byte) (err error) { Lambdas []AWSLogsLambda `json:"lambdas,omitempty"` Services []string `json:"services,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_logs_list_services_response.go b/api/datadogV1/model_aws_logs_list_services_response.go index c79987bade6..fed1d1426bd 100644 --- a/api/datadogV1/model_aws_logs_list_services_response.go +++ b/api/datadogV1/model_aws_logs_list_services_response.go @@ -120,8 +120,7 @@ func (o *AWSLogsListServicesResponse) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Label *string `json:"label,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_logs_services_request.go b/api/datadogV1/model_aws_logs_services_request.go index d7f8024a274..26c1aca9e89 100644 --- a/api/datadogV1/model_aws_logs_services_request.go +++ b/api/datadogV1/model_aws_logs_services_request.go @@ -105,26 +105,11 @@ func (o AWSLogsServicesRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AWSLogsServicesRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { AccountId *string `json:"account_id"` Services *[]string `json:"services"` }{} - all := struct { - AccountId string `json:"account_id"` - Services []string `json:"services"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccountId == nil { - return fmt.Errorf("required field account_id missing") - } - if required.Services == nil { - return fmt.Errorf("required field services missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *AWSLogsServicesRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AccountId == nil { + return fmt.Errorf("required field account_id missing") + } + if all.Services == nil { + return fmt.Errorf("required field services missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "services"}) } else { return err } - o.AccountId = all.AccountId - o.Services = all.Services + o.AccountId = *all.AccountId + o.Services = *all.Services if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_aws_tag_filter.go b/api/datadogV1/model_aws_tag_filter.go index b1cf9b6bc90..74d3f160031 100644 --- a/api/datadogV1/model_aws_tag_filter.go +++ b/api/datadogV1/model_aws_tag_filter.go @@ -120,8 +120,7 @@ func (o *AWSTagFilter) UnmarshalJSON(bytes []byte) (err error) { Namespace *AWSNamespace `json:"namespace,omitempty"` TagFilterStr *string `json:"tag_filter_str,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_tag_filter_create_request.go b/api/datadogV1/model_aws_tag_filter_create_request.go index 09833aadac9..79d39c60787 100644 --- a/api/datadogV1/model_aws_tag_filter_create_request.go +++ b/api/datadogV1/model_aws_tag_filter_create_request.go @@ -154,8 +154,7 @@ func (o *AWSTagFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { Namespace *AWSNamespace `json:"namespace,omitempty"` TagFilterStr *string `json:"tag_filter_str,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_tag_filter_delete_request.go b/api/datadogV1/model_aws_tag_filter_delete_request.go index 8902e5ef192..02af4a3fc80 100644 --- a/api/datadogV1/model_aws_tag_filter_delete_request.go +++ b/api/datadogV1/model_aws_tag_filter_delete_request.go @@ -120,8 +120,7 @@ func (o *AWSTagFilterDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { AccountId *string `json:"account_id,omitempty"` Namespace *AWSNamespace `json:"namespace,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_aws_tag_filter_list_response.go b/api/datadogV1/model_aws_tag_filter_list_response.go index 3eb1eb0746a..c3de688be67 100644 --- a/api/datadogV1/model_aws_tag_filter_list_response.go +++ b/api/datadogV1/model_aws_tag_filter_list_response.go @@ -86,8 +86,7 @@ func (o *AWSTagFilterListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Filters []AWSTagFilter `json:"filters,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_azure_account.go b/api/datadogV1/model_azure_account.go index 326700f1c67..8dc661f1f16 100644 --- a/api/datadogV1/model_azure_account.go +++ b/api/datadogV1/model_azure_account.go @@ -325,8 +325,7 @@ func (o *AzureAccount) UnmarshalJSON(bytes []byte) (err error) { NewTenantName *string `json:"new_tenant_name,omitempty"` TenantName *string `json:"tenant_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_cancel_downtimes_by_scope_request.go b/api/datadogV1/model_cancel_downtimes_by_scope_request.go index 4f6c5285141..1249d7822f1 100644 --- a/api/datadogV1/model_cancel_downtimes_by_scope_request.go +++ b/api/datadogV1/model_cancel_downtimes_by_scope_request.go @@ -80,21 +80,10 @@ func (o CancelDowntimesByScopeRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CancelDowntimesByScopeRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Scope *string `json:"scope"` - }{} all := struct { - Scope string `json:"scope"` + Scope *string `json:"scope"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Scope == nil { - return fmt.Errorf("required field scope missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -102,13 +91,16 @@ func (o *CancelDowntimesByScopeRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Scope == nil { + return fmt.Errorf("required field scope missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"scope"}) } else { return err } - o.Scope = all.Scope + o.Scope = *all.Scope if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_canceled_downtimes_ids.go b/api/datadogV1/model_canceled_downtimes_ids.go index e3a326c59d6..dfeaf538508 100644 --- a/api/datadogV1/model_canceled_downtimes_ids.go +++ b/api/datadogV1/model_canceled_downtimes_ids.go @@ -86,8 +86,7 @@ func (o *CanceledDowntimesIds) UnmarshalJSON(bytes []byte) (err error) { all := struct { CancelledIds []int64 `json:"cancelled_ids,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_change_widget_definition.go b/api/datadogV1/model_change_widget_definition.go index 937ded8b832..d3282481bbf 100644 --- a/api/datadogV1/model_change_widget_definition.go +++ b/api/datadogV1/model_change_widget_definition.go @@ -275,31 +275,16 @@ func (o ChangeWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]ChangeWidgetRequest `json:"requests"` - Type *ChangeWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []ChangeWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ChangeWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests *[]ChangeWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *ChangeWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -307,6 +292,12 @@ func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "requests", "time", "title", "title_align", "title_size", "type"}) @@ -330,7 +321,7 @@ func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.CustomLinks = all.CustomLinks - o.Requests = all.Requests + o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -342,7 +333,7 @@ func (o *ChangeWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_change_widget_request.go b/api/datadogV1/model_change_widget_request.go index 58bbd6dcb00..0bcb3ae23a0 100644 --- a/api/datadogV1/model_change_widget_request.go +++ b/api/datadogV1/model_change_widget_request.go @@ -664,8 +664,7 @@ func (o *ChangeWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` ShowPresent *bool `json:"show_present,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_check_can_delete_monitor_response.go b/api/datadogV1/model_check_can_delete_monitor_response.go index 2c7d48c8c27..bf18db0d9ab 100644 --- a/api/datadogV1/model_check_can_delete_monitor_response.go +++ b/api/datadogV1/model_check_can_delete_monitor_response.go @@ -112,22 +112,11 @@ func (o CheckCanDeleteMonitorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *CheckCanDeleteMonitorResponseData `json:"data"` - }{} all := struct { - Data CheckCanDeleteMonitorResponseData `json:"data"` - Errors map[string][]string `json:"errors,omitempty"` + Data *CheckCanDeleteMonitorResponseData `json:"data"` + Errors map[string][]string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -135,6 +124,9 @@ func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "errors"}) @@ -148,7 +140,7 @@ func (o *CheckCanDeleteMonitorResponse) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Errors = all.Errors if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_check_can_delete_monitor_response_data.go b/api/datadogV1/model_check_can_delete_monitor_response_data.go index 82cd51e73b2..9ce1a2d5402 100644 --- a/api/datadogV1/model_check_can_delete_monitor_response_data.go +++ b/api/datadogV1/model_check_can_delete_monitor_response_data.go @@ -86,8 +86,7 @@ func (o *CheckCanDeleteMonitorResponseData) UnmarshalJSON(bytes []byte) (err err all := struct { Ok []int64 `json:"ok,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_check_can_delete_slo_response.go b/api/datadogV1/model_check_can_delete_slo_response.go index 3737b80c19d..192087b4b21 100644 --- a/api/datadogV1/model_check_can_delete_slo_response.go +++ b/api/datadogV1/model_check_can_delete_slo_response.go @@ -120,8 +120,7 @@ func (o *CheckCanDeleteSLOResponse) UnmarshalJSON(bytes []byte) (err error) { Data *CheckCanDeleteSLOResponseData `json:"data,omitempty"` Errors map[string]string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_check_can_delete_slo_response_data.go b/api/datadogV1/model_check_can_delete_slo_response_data.go index 0616ab8a1c6..614c46f744b 100644 --- a/api/datadogV1/model_check_can_delete_slo_response_data.go +++ b/api/datadogV1/model_check_can_delete_slo_response_data.go @@ -86,8 +86,7 @@ func (o *CheckCanDeleteSLOResponseData) UnmarshalJSON(bytes []byte) (err error) all := struct { Ok []string `json:"ok,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_check_status_widget_definition.go b/api/datadogV1/model_check_status_widget_definition.go index 1bec50525b8..3d5d84e9370 100644 --- a/api/datadogV1/model_check_status_widget_definition.go +++ b/api/datadogV1/model_check_status_widget_definition.go @@ -365,38 +365,19 @@ func (o CheckStatusWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Check *string `json:"check"` - Grouping *WidgetGrouping `json:"grouping"` - Type *CheckStatusWidgetDefinitionType `json:"type"` - }{} all := struct { - Check string `json:"check"` - Group *string `json:"group,omitempty"` - GroupBy []string `json:"group_by,omitempty"` - Grouping WidgetGrouping `json:"grouping"` - Tags []string `json:"tags,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type CheckStatusWidgetDefinitionType `json:"type"` + Check *string `json:"check"` + Group *string `json:"group,omitempty"` + GroupBy []string `json:"group_by,omitempty"` + Grouping *WidgetGrouping `json:"grouping"` + Tags []string `json:"tags,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *CheckStatusWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Check == nil { - return fmt.Errorf("required field check missing") - } - if required.Grouping == nil { - return fmt.Errorf("required field grouping missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -404,6 +385,15 @@ func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Check == nil { + return fmt.Errorf("required field check missing") + } + if all.Grouping == nil { + return fmt.Errorf("required field grouping missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"check", "group", "group_by", "grouping", "tags", "time", "title", "title_align", "title_size", "type"}) @@ -434,10 +424,10 @@ func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Check = all.Check + o.Check = *all.Check o.Group = all.Group o.GroupBy = all.GroupBy - o.Grouping = all.Grouping + o.Grouping = *all.Grouping o.Tags = all.Tags if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -450,7 +440,7 @@ func (o *CheckStatusWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_creator.go b/api/datadogV1/model_creator.go index 404a46f117c..5a56ac2cca2 100644 --- a/api/datadogV1/model_creator.go +++ b/api/datadogV1/model_creator.go @@ -165,8 +165,7 @@ func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { Handle *string `json:"handle,omitempty"` Name datadog.NullableString `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard.go b/api/datadogV1/model_dashboard.go index 418981d021b..a6c8f481119 100644 --- a/api/datadogV1/model_dashboard.go +++ b/api/datadogV1/model_dashboard.go @@ -660,11 +660,6 @@ func (o Dashboard) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - LayoutType *DashboardLayoutType `json:"layout_type"` - Title *string `json:"title"` - Widgets *[]Widget `json:"widgets"` - }{} all := struct { AuthorHandle *string `json:"author_handle,omitempty"` AuthorName datadog.NullableString `json:"author_name,omitempty"` @@ -672,7 +667,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { Description datadog.NullableString `json:"description,omitempty"` Id *string `json:"id,omitempty"` IsReadOnly *bool `json:"is_read_only,omitempty"` - LayoutType DashboardLayoutType `json:"layout_type"` + LayoutType *DashboardLayoutType `json:"layout_type"` ModifiedAt *time.Time `json:"modified_at,omitempty"` NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"` ReflowType *DashboardReflowType `json:"reflow_type,omitempty"` @@ -680,25 +675,11 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { Tags datadog.NullableList[string] `json:"tags,omitempty"` TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"` TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"` - Title string `json:"title"` + Title *string `json:"title"` Url *string `json:"url,omitempty"` - Widgets []Widget `json:"widgets"` + Widgets *[]Widget `json:"widgets"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LayoutType == nil { - return fmt.Errorf("required field layout_type missing") - } - if required.Title == nil { - return fmt.Errorf("required field title missing") - } - if required.Widgets == nil { - return fmt.Errorf("required field widgets missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -706,6 +687,15 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.LayoutType == nil { + return fmt.Errorf("required field layout_type missing") + } + if all.Title == nil { + return fmt.Errorf("required field title missing") + } + if all.Widgets == nil { + return fmt.Errorf("required field widgets missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author_handle", "author_name", "created_at", "description", "id", "is_read_only", "layout_type", "modified_at", "notify_list", "reflow_type", "restricted_roles", "tags", "template_variable_presets", "template_variables", "title", "url", "widgets"}) @@ -734,7 +724,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { o.Description = all.Description o.Id = all.Id o.IsReadOnly = all.IsReadOnly - o.LayoutType = all.LayoutType + o.LayoutType = *all.LayoutType o.ModifiedAt = all.ModifiedAt o.NotifyList = all.NotifyList o.ReflowType = all.ReflowType @@ -742,9 +732,9 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) { o.Tags = all.Tags o.TemplateVariablePresets = all.TemplateVariablePresets o.TemplateVariables = all.TemplateVariables - o.Title = all.Title + o.Title = *all.Title o.Url = all.Url - o.Widgets = all.Widgets + o.Widgets = *all.Widgets if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_dashboard_bulk_action_data.go b/api/datadogV1/model_dashboard_bulk_action_data.go index 43e512b55da..8d7c06e7fc0 100644 --- a/api/datadogV1/model_dashboard_bulk_action_data.go +++ b/api/datadogV1/model_dashboard_bulk_action_data.go @@ -107,26 +107,11 @@ func (o DashboardBulkActionData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *DashboardResourceType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type DashboardResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *DashboardBulkActionData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_dashboard_bulk_delete_request.go b/api/datadogV1/model_dashboard_bulk_delete_request.go index ee4a15b6b82..45b9cd061ba 100644 --- a/api/datadogV1/model_dashboard_bulk_delete_request.go +++ b/api/datadogV1/model_dashboard_bulk_delete_request.go @@ -78,21 +78,10 @@ func (o DashboardBulkDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardBulkDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]DashboardBulkActionData `json:"data"` - }{} all := struct { - Data []DashboardBulkActionData `json:"data"` + Data *[]DashboardBulkActionData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *DashboardBulkDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_dashboard_delete_response.go b/api/datadogV1/model_dashboard_delete_response.go index 7e80029645c..88f7fd5c428 100644 --- a/api/datadogV1/model_dashboard_delete_response.go +++ b/api/datadogV1/model_dashboard_delete_response.go @@ -86,8 +86,7 @@ func (o *DashboardDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { DeletedDashboardId *string `json:"deleted_dashboard_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_global_time.go b/api/datadogV1/model_dashboard_global_time.go index fc582ceb312..298789797f6 100644 --- a/api/datadogV1/model_dashboard_global_time.go +++ b/api/datadogV1/model_dashboard_global_time.go @@ -86,8 +86,7 @@ func (o *DashboardGlobalTime) UnmarshalJSON(bytes []byte) (err error) { all := struct { LiveSpan *DashboardGlobalTimeLiveSpan `json:"live_span,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_list.go b/api/datadogV1/model_dashboard_list.go index 0929e4c2f46..a47795aff8b 100644 --- a/api/datadogV1/model_dashboard_list.go +++ b/api/datadogV1/model_dashboard_list.go @@ -318,9 +318,6 @@ func (o DashboardList) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Author *Creator `json:"author,omitempty"` Created *time.Time `json:"created,omitempty"` @@ -328,18 +325,10 @@ func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { Id *int64 `json:"id,omitempty"` IsFavorite *bool `json:"is_favorite,omitempty"` Modified *time.Time `json:"modified,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -347,6 +336,9 @@ func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author", "created", "dashboard_count", "id", "is_favorite", "modified", "name", "type"}) @@ -366,7 +358,7 @@ func (o *DashboardList) UnmarshalJSON(bytes []byte) (err error) { o.Id = all.Id o.IsFavorite = all.IsFavorite o.Modified = all.Modified - o.Name = all.Name + o.Name = *all.Name o.Type = all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_dashboard_list_delete_response.go b/api/datadogV1/model_dashboard_list_delete_response.go index dc41280e9be..5a636907474 100644 --- a/api/datadogV1/model_dashboard_list_delete_response.go +++ b/api/datadogV1/model_dashboard_list_delete_response.go @@ -86,8 +86,7 @@ func (o *DashboardListDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { DeletedDashboardListId *int64 `json:"deleted_dashboard_list_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_list_list_response.go b/api/datadogV1/model_dashboard_list_list_response.go index eba97c1d6cf..92673f883a7 100644 --- a/api/datadogV1/model_dashboard_list_list_response.go +++ b/api/datadogV1/model_dashboard_list_list_response.go @@ -86,8 +86,7 @@ func (o *DashboardListListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { DashboardLists []DashboardList `json:"dashboard_lists,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_restore_request.go b/api/datadogV1/model_dashboard_restore_request.go index b296ccd09ff..f58c53bf37b 100644 --- a/api/datadogV1/model_dashboard_restore_request.go +++ b/api/datadogV1/model_dashboard_restore_request.go @@ -78,21 +78,10 @@ func (o DashboardRestoreRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardRestoreRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]DashboardBulkActionData `json:"data"` - }{} all := struct { - Data []DashboardBulkActionData `json:"data"` + Data *[]DashboardBulkActionData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *DashboardRestoreRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_dashboard_summary.go b/api/datadogV1/model_dashboard_summary.go index a3a4c50530f..1d8b4da1185 100644 --- a/api/datadogV1/model_dashboard_summary.go +++ b/api/datadogV1/model_dashboard_summary.go @@ -86,8 +86,7 @@ func (o *DashboardSummary) UnmarshalJSON(bytes []byte) (err error) { all := struct { Dashboards []DashboardSummaryDefinition `json:"dashboards,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_summary_definition.go b/api/datadogV1/model_dashboard_summary_definition.go index 728ad7e95c6..d28f62b3549 100644 --- a/api/datadogV1/model_dashboard_summary_definition.go +++ b/api/datadogV1/model_dashboard_summary_definition.go @@ -378,8 +378,7 @@ func (o *DashboardSummaryDefinition) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title,omitempty"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_template_variable.go b/api/datadogV1/model_dashboard_template_variable.go index 3288b35ef89..b07f267ac0f 100644 --- a/api/datadogV1/model_dashboard_template_variable.go +++ b/api/datadogV1/model_dashboard_template_variable.go @@ -247,25 +247,14 @@ func (o DashboardTemplateVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { AvailableValues datadog.NullableList[string] `json:"available_values,omitempty"` Default datadog.NullableString `json:"default,omitempty"` Defaults []string `json:"defaults,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Prefix datadog.NullableString `json:"prefix,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -273,6 +262,9 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"available_values", "default", "defaults", "name", "prefix"}) @@ -282,7 +274,7 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) { o.AvailableValues = all.AvailableValues o.Default = all.Default o.Defaults = all.Defaults - o.Name = all.Name + o.Name = *all.Name o.Prefix = all.Prefix if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_dashboard_template_variable_preset.go b/api/datadogV1/model_dashboard_template_variable_preset.go index f0318656f0b..b7f281437e0 100644 --- a/api/datadogV1/model_dashboard_template_variable_preset.go +++ b/api/datadogV1/model_dashboard_template_variable_preset.go @@ -120,8 +120,7 @@ func (o *DashboardTemplateVariablePreset) UnmarshalJSON(bytes []byte) (err error Name *string `json:"name,omitempty"` TemplateVariables []DashboardTemplateVariablePresetValue `json:"template_variables,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_dashboard_template_variable_preset_value.go b/api/datadogV1/model_dashboard_template_variable_preset_value.go index 918211f2575..93334da46ef 100644 --- a/api/datadogV1/model_dashboard_template_variable_preset_value.go +++ b/api/datadogV1/model_dashboard_template_variable_preset_value.go @@ -158,8 +158,7 @@ func (o *DashboardTemplateVariablePresetValue) UnmarshalJSON(bytes []byte) (err Value *string `json:"value,omitempty"` Values []string `json:"values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_delete_shared_dashboard_response.go b/api/datadogV1/model_delete_shared_dashboard_response.go index a9f5814a5e7..79980c464fb 100644 --- a/api/datadogV1/model_delete_shared_dashboard_response.go +++ b/api/datadogV1/model_delete_shared_dashboard_response.go @@ -86,8 +86,7 @@ func (o *DeleteSharedDashboardResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { DeletedPublicDashboardToken *string `json:"deleted_public_dashboard_token,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_deleted_monitor.go b/api/datadogV1/model_deleted_monitor.go index 8325131a5c7..f43594a884a 100644 --- a/api/datadogV1/model_deleted_monitor.go +++ b/api/datadogV1/model_deleted_monitor.go @@ -86,8 +86,7 @@ func (o *DeletedMonitor) UnmarshalJSON(bytes []byte) (err error) { all := struct { DeletedMonitorId *int64 `json:"deleted_monitor_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_distribution_points_payload.go b/api/datadogV1/model_distribution_points_payload.go index 16f66e01b55..7aa963b5a31 100644 --- a/api/datadogV1/model_distribution_points_payload.go +++ b/api/datadogV1/model_distribution_points_payload.go @@ -78,21 +78,10 @@ func (o DistributionPointsPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionPointsPayload) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Series *[]DistributionPointsSeries `json:"series"` - }{} all := struct { - Series []DistributionPointsSeries `json:"series"` + Series *[]DistributionPointsSeries `json:"series"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Series == nil { - return fmt.Errorf("required field series missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *DistributionPointsPayload) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Series == nil { + return fmt.Errorf("required field series missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"series"}) } else { return err } - o.Series = all.Series + o.Series = *all.Series if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_distribution_points_series.go b/api/datadogV1/model_distribution_points_series.go index ecd4bc6d7b7..ad617a60076 100644 --- a/api/datadogV1/model_distribution_points_series.go +++ b/api/datadogV1/model_distribution_points_series.go @@ -208,29 +208,14 @@ func (o DistributionPointsSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { + Host *string `json:"host,omitempty"` Metric *string `json:"metric"` Points *[][]DistributionPointItem `json:"points"` + Tags []string `json:"tags,omitempty"` + Type *DistributionPointsType `json:"type,omitempty"` }{} - all := struct { - Host *string `json:"host,omitempty"` - Metric string `json:"metric"` - Points [][]DistributionPointItem `json:"points"` - Tags []string `json:"tags,omitempty"` - Type *DistributionPointsType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("required field metric missing") - } - if required.Points == nil { - return fmt.Errorf("required field points missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -238,6 +223,12 @@ func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Metric == nil { + return fmt.Errorf("required field metric missing") + } + if all.Points == nil { + return fmt.Errorf("required field points missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"host", "metric", "points", "tags", "type"}) @@ -253,8 +244,8 @@ func (o *DistributionPointsSeries) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Host = all.Host - o.Metric = all.Metric - o.Points = all.Points + o.Metric = *all.Metric + o.Points = *all.Points o.Tags = all.Tags o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_distribution_widget_definition.go b/api/datadogV1/model_distribution_widget_definition.go index 3d6ca9659b0..f1642040f93 100644 --- a/api/datadogV1/model_distribution_widget_definition.go +++ b/api/datadogV1/model_distribution_widget_definition.go @@ -417,35 +417,20 @@ func (o DistributionWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]DistributionWidgetRequest `json:"requests"` - Type *DistributionWidgetDefinitionType `json:"type"` - }{} all := struct { - LegendSize *string `json:"legend_size,omitempty"` - Markers []WidgetMarker `json:"markers,omitempty"` - Requests []DistributionWidgetRequest `json:"requests"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type DistributionWidgetDefinitionType `json:"type"` - Xaxis *DistributionWidgetXAxis `json:"xaxis,omitempty"` - Yaxis *DistributionWidgetYAxis `json:"yaxis,omitempty"` + LegendSize *string `json:"legend_size,omitempty"` + Markers []WidgetMarker `json:"markers,omitempty"` + Requests *[]DistributionWidgetRequest `json:"requests"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *DistributionWidgetDefinitionType `json:"type"` + Xaxis *DistributionWidgetXAxis `json:"xaxis,omitempty"` + Yaxis *DistributionWidgetYAxis `json:"yaxis,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -453,6 +438,12 @@ func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"legend_size", "markers", "requests", "show_legend", "time", "title", "title_align", "title_size", "type", "xaxis", "yaxis"}) @@ -477,7 +468,7 @@ func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.LegendSize = all.LegendSize o.Markers = all.Markers - o.Requests = all.Requests + o.Requests = *all.Requests o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -490,7 +481,7 @@ func (o *DistributionWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_distribution_widget_request.go b/api/datadogV1/model_distribution_widget_request.go index 08aa325e45d..29d4d24ffde 100644 --- a/api/datadogV1/model_distribution_widget_request.go +++ b/api/datadogV1/model_distribution_widget_request.go @@ -494,8 +494,7 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` Style *WidgetStyle `json:"style,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_distribution_widget_x_axis.go b/api/datadogV1/model_distribution_widget_x_axis.go index 0cebd79a3e2..acf1066717f 100644 --- a/api/datadogV1/model_distribution_widget_x_axis.go +++ b/api/datadogV1/model_distribution_widget_x_axis.go @@ -200,8 +200,7 @@ func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { Min *string `json:"min,omitempty"` Scale *string `json:"scale,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_distribution_widget_y_axis.go b/api/datadogV1/model_distribution_widget_y_axis.go index 830fa4c6041..d8a292c81d3 100644 --- a/api/datadogV1/model_distribution_widget_y_axis.go +++ b/api/datadogV1/model_distribution_widget_y_axis.go @@ -234,8 +234,7 @@ func (o *DistributionWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { Min *string `json:"min,omitempty"` Scale *string `json:"scale,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_downtime.go b/api/datadogV1/model_downtime.go index 5337ced08f5..07ab5156469 100644 --- a/api/datadogV1/model_downtime.go +++ b/api/datadogV1/model_downtime.go @@ -838,8 +838,7 @@ func (o *Downtime) UnmarshalJSON(bytes []byte) (err error) { Timezone *string `json:"timezone,omitempty"` UpdaterId datadog.NullableInt32 `json:"updater_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_downtime_child.go b/api/datadogV1/model_downtime_child.go index aa555c14703..be4810d3cde 100644 --- a/api/datadogV1/model_downtime_child.go +++ b/api/datadogV1/model_downtime_child.go @@ -790,8 +790,7 @@ func (o *DowntimeChild) UnmarshalJSON(bytes []byte) (err error) { Timezone *string `json:"timezone,omitempty"` UpdaterId datadog.NullableInt32 `json:"updater_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_downtime_recurrence.go b/api/datadogV1/model_downtime_recurrence.go index c20353acccd..06b6dc1bbc8 100644 --- a/api/datadogV1/model_downtime_recurrence.go +++ b/api/datadogV1/model_downtime_recurrence.go @@ -298,8 +298,7 @@ func (o *DowntimeRecurrence) UnmarshalJSON(bytes []byte) (err error) { UntilOccurrences datadog.NullableInt32 `json:"until_occurrences,omitempty"` WeekDays datadog.NullableList[string] `json:"week_days,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_event.go b/api/datadogV1/model_event.go index 8be074055e5..10bdc189633 100644 --- a/api/datadogV1/model_event.go +++ b/api/datadogV1/model_event.go @@ -513,8 +513,7 @@ func (o *Event) UnmarshalJSON(bytes []byte) (err error) { Title *string `json:"title,omitempty"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_event_create_request.go b/api/datadogV1/model_event_create_request.go index dd094f8703e..dcbd8edfacd 100644 --- a/api/datadogV1/model_event_create_request.go +++ b/api/datadogV1/model_event_create_request.go @@ -421,10 +421,6 @@ func (o EventCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Text *string `json:"text"` - Title *string `json:"title"` - }{} all := struct { AggregationKey *string `json:"aggregation_key,omitempty"` AlertType *EventAlertType `json:"alert_type,omitempty"` @@ -435,21 +431,10 @@ func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { RelatedEventId *int64 `json:"related_event_id,omitempty"` SourceTypeName *string `json:"source_type_name,omitempty"` Tags []string `json:"tags,omitempty"` - Text string `json:"text"` - Title string `json:"title"` + Text *string `json:"text"` + Title *string `json:"title"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Text == nil { - return fmt.Errorf("required field text missing") - } - if required.Title == nil { - return fmt.Errorf("required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -457,6 +442,12 @@ func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Text == nil { + return fmt.Errorf("required field text missing") + } + if all.Title == nil { + return fmt.Errorf("required field title missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation_key", "alert_type", "date_happened", "device_name", "host", "priority", "related_event_id", "source_type_name", "tags", "text", "title"}) @@ -488,8 +479,8 @@ func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.RelatedEventId = all.RelatedEventId o.SourceTypeName = all.SourceTypeName o.Tags = all.Tags - o.Text = all.Text - o.Title = all.Title + o.Text = *all.Text + o.Title = *all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_event_create_response.go b/api/datadogV1/model_event_create_response.go index 80d8eafd6df..cdc1e8c360e 100644 --- a/api/datadogV1/model_event_create_response.go +++ b/api/datadogV1/model_event_create_response.go @@ -120,8 +120,7 @@ func (o *EventCreateResponse) UnmarshalJSON(bytes []byte) (err error) { Event *Event `json:"event,omitempty"` Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_event_list_response.go b/api/datadogV1/model_event_list_response.go index 777efc80549..b553363b6d7 100644 --- a/api/datadogV1/model_event_list_response.go +++ b/api/datadogV1/model_event_list_response.go @@ -120,8 +120,7 @@ func (o *EventListResponse) UnmarshalJSON(bytes []byte) (err error) { Events []Event `json:"events,omitempty"` Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_event_query_definition.go b/api/datadogV1/model_event_query_definition.go index 5c6d0530b9d..002fe21cf39 100644 --- a/api/datadogV1/model_event_query_definition.go +++ b/api/datadogV1/model_event_query_definition.go @@ -105,26 +105,11 @@ func (o EventQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Search *string `json:"search"` TagsExecution *string `json:"tags_execution"` }{} - all := struct { - Search string `json:"search"` - TagsExecution string `json:"tags_execution"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Search == nil { - return fmt.Errorf("required field search missing") - } - if required.TagsExecution == nil { - return fmt.Errorf("required field tags_execution missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *EventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Search == nil { + return fmt.Errorf("required field search missing") + } + if all.TagsExecution == nil { + return fmt.Errorf("required field tags_execution missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"search", "tags_execution"}) } else { return err } - o.Search = all.Search - o.TagsExecution = all.TagsExecution + o.Search = *all.Search + o.TagsExecution = *all.TagsExecution if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_event_response.go b/api/datadogV1/model_event_response.go index fc1e21cc4bf..0a1752cc5d8 100644 --- a/api/datadogV1/model_event_response.go +++ b/api/datadogV1/model_event_response.go @@ -120,8 +120,7 @@ func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { Event *Event `json:"event,omitempty"` Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_event_stream_widget_definition.go b/api/datadogV1/model_event_stream_widget_definition.go index c3b650e352a..ecb2bc374b5 100644 --- a/api/datadogV1/model_event_stream_widget_definition.go +++ b/api/datadogV1/model_event_stream_widget_definition.go @@ -306,32 +306,17 @@ func (o EventStreamWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *EventStreamWidgetDefinitionType `json:"type"` - }{} all := struct { - EventSize *WidgetEventSize `json:"event_size,omitempty"` - Query string `json:"query"` - TagsExecution *string `json:"tags_execution,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type EventStreamWidgetDefinitionType `json:"type"` + EventSize *WidgetEventSize `json:"event_size,omitempty"` + Query *string `json:"query"` + TagsExecution *string `json:"tags_execution,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *EventStreamWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -339,6 +324,12 @@ func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"event_size", "query", "tags_execution", "time", "title", "title_align", "title_size", "type"}) @@ -370,7 +361,7 @@ func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.EventSize = all.EventSize - o.Query = all.Query + o.Query = *all.Query o.TagsExecution = all.TagsExecution if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -383,7 +374,7 @@ func (o *EventStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_event_timeline_widget_definition.go b/api/datadogV1/model_event_timeline_widget_definition.go index 3b21b0aae6e..dcbdd023f15 100644 --- a/api/datadogV1/model_event_timeline_widget_definition.go +++ b/api/datadogV1/model_event_timeline_widget_definition.go @@ -272,31 +272,16 @@ func (o EventTimelineWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *EventTimelineWidgetDefinitionType `json:"type"` - }{} all := struct { - Query string `json:"query"` - TagsExecution *string `json:"tags_execution,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type EventTimelineWidgetDefinitionType `json:"type"` + Query *string `json:"query"` + TagsExecution *string `json:"tags_execution,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *EventTimelineWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -304,6 +289,12 @@ func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query", "tags_execution", "time", "title", "title_align", "title_size", "type"}) @@ -326,7 +317,7 @@ func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Query = all.Query + o.Query = *all.Query o.TagsExecution = all.TagsExecution if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -339,7 +330,7 @@ func (o *EventTimelineWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go b/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go index cce44564292..0dd445db2ee 100644 --- a/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go +++ b/api/datadogV1/model_formula_and_function_apm_dependency_stats_query_definition.go @@ -339,61 +339,47 @@ func (o FormulaAndFunctionApmDependencyStatsQueryDefinition) MarshalJSON() ([]by // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` - Env *string `json:"env"` - Name *string `json:"name"` - OperationName *string `json:"operation_name"` - ResourceName *string `json:"resource_name"` - Service *string `json:"service"` - Stat *FormulaAndFunctionApmDependencyStatName `json:"stat"` - }{} all := struct { - DataSource FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` - Env string `json:"env"` - IsUpstream *bool `json:"is_upstream,omitempty"` - Name string `json:"name"` - OperationName string `json:"operation_name"` - PrimaryTagName *string `json:"primary_tag_name,omitempty"` - PrimaryTagValue *string `json:"primary_tag_value,omitempty"` - ResourceName string `json:"resource_name"` - Service string `json:"service"` - Stat FormulaAndFunctionApmDependencyStatName `json:"stat"` + DataSource *FormulaAndFunctionApmDependencyStatsDataSource `json:"data_source"` + Env *string `json:"env"` + IsUpstream *bool `json:"is_upstream,omitempty"` + Name *string `json:"name"` + OperationName *string `json:"operation_name"` + PrimaryTagName *string `json:"primary_tag_name,omitempty"` + PrimaryTagValue *string `json:"primary_tag_value,omitempty"` + ResourceName *string `json:"resource_name"` + Service *string `json:"service"` + Stat *FormulaAndFunctionApmDependencyStatName `json:"stat"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.DataSource == nil { + if all.DataSource == nil { return fmt.Errorf("required field data_source missing") } - if required.Env == nil { + if all.Env == nil { return fmt.Errorf("required field env missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.OperationName == nil { + if all.OperationName == nil { return fmt.Errorf("required field operation_name missing") } - if required.ResourceName == nil { + if all.ResourceName == nil { return fmt.Errorf("required field resource_name missing") } - if required.Service == nil { + if all.Service == nil { return fmt.Errorf("required field service missing") } - if required.Stat == nil { + if all.Stat == nil { return fmt.Errorf("required field stat missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "env", "is_upstream", "name", "operation_name", "primary_tag_name", "primary_tag_value", "resource_name", "service", "stat"}) @@ -416,16 +402,16 @@ func (o *FormulaAndFunctionApmDependencyStatsQueryDefinition) UnmarshalJSON(byte o.UnparsedObject = raw return nil } - o.DataSource = all.DataSource - o.Env = all.Env + o.DataSource = *all.DataSource + o.Env = *all.Env o.IsUpstream = all.IsUpstream - o.Name = all.Name - o.OperationName = all.OperationName + o.Name = *all.Name + o.OperationName = *all.OperationName o.PrimaryTagName = all.PrimaryTagName o.PrimaryTagValue = all.PrimaryTagValue - o.ResourceName = all.ResourceName - o.Service = all.Service - o.Stat = all.Stat + o.ResourceName = *all.ResourceName + o.Service = *all.Service + o.Stat = *all.Stat if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go b/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go index f36ab91347b..f077598e70e 100644 --- a/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go +++ b/api/datadogV1/model_formula_and_function_apm_resource_stats_query_definition.go @@ -351,53 +351,41 @@ func (o FormulaAndFunctionApmResourceStatsQueryDefinition) MarshalJSON() ([]byte // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` - Env *string `json:"env"` - Name *string `json:"name"` - Service *string `json:"service"` - Stat *FormulaAndFunctionApmResourceStatName `json:"stat"` - }{} all := struct { - DataSource FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` - Env string `json:"env"` - GroupBy []string `json:"group_by,omitempty"` - Name string `json:"name"` - OperationName *string `json:"operation_name,omitempty"` - PrimaryTagName *string `json:"primary_tag_name,omitempty"` - PrimaryTagValue *string `json:"primary_tag_value,omitempty"` - ResourceName *string `json:"resource_name,omitempty"` - Service string `json:"service"` - Stat FormulaAndFunctionApmResourceStatName `json:"stat"` + DataSource *FormulaAndFunctionApmResourceStatsDataSource `json:"data_source"` + Env *string `json:"env"` + GroupBy []string `json:"group_by,omitempty"` + Name *string `json:"name"` + OperationName *string `json:"operation_name,omitempty"` + PrimaryTagName *string `json:"primary_tag_name,omitempty"` + PrimaryTagValue *string `json:"primary_tag_value,omitempty"` + ResourceName *string `json:"resource_name,omitempty"` + Service *string `json:"service"` + Stat *FormulaAndFunctionApmResourceStatName `json:"stat"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.DataSource == nil { + if all.DataSource == nil { return fmt.Errorf("required field data_source missing") } - if required.Env == nil { + if all.Env == nil { return fmt.Errorf("required field env missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Service == nil { + if all.Service == nil { return fmt.Errorf("required field service missing") } - if required.Stat == nil { + if all.Stat == nil { return fmt.Errorf("required field stat missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "env", "group_by", "name", "operation_name", "primary_tag_name", "primary_tag_value", "resource_name", "service", "stat"}) @@ -420,16 +408,16 @@ func (o *FormulaAndFunctionApmResourceStatsQueryDefinition) UnmarshalJSON(bytes o.UnparsedObject = raw return nil } - o.DataSource = all.DataSource - o.Env = all.Env + o.DataSource = *all.DataSource + o.Env = *all.Env o.GroupBy = all.GroupBy - o.Name = all.Name + o.Name = *all.Name o.OperationName = all.OperationName o.PrimaryTagName = all.PrimaryTagName o.PrimaryTagValue = all.PrimaryTagValue o.ResourceName = all.ResourceName - o.Service = all.Service - o.Stat = all.Stat + o.Service = *all.Service + o.Stat = *all.Stat if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_formula_and_function_event_query_definition.go b/api/datadogV1/model_formula_and_function_event_query_definition.go index 584ca54e0fb..bd55db58b57 100644 --- a/api/datadogV1/model_formula_and_function_event_query_definition.go +++ b/api/datadogV1/model_formula_and_function_event_query_definition.go @@ -264,35 +264,16 @@ func (o FormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Compute *FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` DataSource *FormulaAndFunctionEventsDataSource `json:"data_source"` + GroupBy []FormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` + Indexes []string `json:"indexes,omitempty"` Name *string `json:"name"` + Search *FormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` + Storage *string `json:"storage,omitempty"` }{} - all := struct { - Compute FormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - DataSource FormulaAndFunctionEventsDataSource `json:"data_source"` - GroupBy []FormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Name string `json:"name"` - Search *FormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` - Storage *string `json:"storage,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("required field compute missing") - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -300,6 +281,15 @@ func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (er o.UnparsedObject = raw return nil } + if all.Compute == nil { + return fmt.Errorf("required field compute missing") + } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "data_source", "group_by", "indexes", "name", "search", "storage"}) @@ -321,11 +311,11 @@ func (o *FormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (er } o.UnparsedObject = raw } - o.Compute = all.Compute - o.DataSource = all.DataSource + o.Compute = *all.Compute + o.DataSource = *all.DataSource o.GroupBy = all.GroupBy o.Indexes = all.Indexes - o.Name = all.Name + o.Name = *all.Name if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_formula_and_function_event_query_definition_compute.go b/api/datadogV1/model_formula_and_function_event_query_definition_compute.go index 31e12bc997a..2d20734d774 100644 --- a/api/datadogV1/model_formula_and_function_event_query_definition_compute.go +++ b/api/datadogV1/model_formula_and_function_event_query_definition_compute.go @@ -144,23 +144,12 @@ func (o FormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` - }{} all := struct { - Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` - Interval *int64 `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` + Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` + Interval *int64 `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "interval", "metric"}) @@ -182,7 +174,7 @@ func (o *FormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_formula_and_function_event_query_definition_search.go b/api/datadogV1/model_formula_and_function_event_query_definition_search.go index 50c2f8881db..bc751d4ac84 100644 --- a/api/datadogV1/model_formula_and_function_event_query_definition_search.go +++ b/api/datadogV1/model_formula_and_function_event_query_definition_search.go @@ -78,21 +78,10 @@ func (o FormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} all := struct { - Query string `json:"query"` + Query *string `json:"query"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *FormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byt o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query"}) } else { return err } - o.Query = all.Query + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_formula_and_function_event_query_group_by.go b/api/datadogV1/model_formula_and_function_event_query_group_by.go index f9c3919d460..014fced64c0 100644 --- a/api/datadogV1/model_formula_and_function_event_query_group_by.go +++ b/api/datadogV1/model_formula_and_function_event_query_group_by.go @@ -144,23 +144,12 @@ func (o FormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Limit *int64 `json:"limit,omitempty"` Sort *FormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *FormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "limit", "sort"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go b/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go index f704b3ac7c3..3c5e3a14111 100644 --- a/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go +++ b/api/datadogV1/model_formula_and_function_event_query_group_by_sort.go @@ -148,23 +148,12 @@ func (o FormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` - }{} all := struct { - Aggregation FormulaAndFunctionEventAggregation `json:"aggregation"` - Metric *string `json:"metric,omitempty"` - Order *QuerySortOrder `json:"order,omitempty"` + Aggregation *FormulaAndFunctionEventAggregation `json:"aggregation"` + Metric *string `json:"metric,omitempty"` + Order *QuerySortOrder `json:"order,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -172,6 +161,9 @@ func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "metric", "order"}) @@ -194,7 +186,7 @@ func (o *FormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Metric = all.Metric o.Order = all.Order if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_formula_and_function_metric_query_definition.go b/api/datadogV1/model_formula_and_function_metric_query_definition.go index 734e1689e32..01996f888b1 100644 --- a/api/datadogV1/model_formula_and_function_metric_query_definition.go +++ b/api/datadogV1/model_formula_and_function_metric_query_definition.go @@ -165,32 +165,13 @@ func (o FormulaAndFunctionMetricQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionMetricDataSource `json:"data_source"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} all := struct { Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` - DataSource FormulaAndFunctionMetricDataSource `json:"data_source"` - Name string `json:"name"` - Query string `json:"query"` + DataSource *FormulaAndFunctionMetricDataSource `json:"data_source"` + Name *string `json:"name"` + Query *string `json:"query"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,6 +179,15 @@ func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregator", "data_source", "name", "query"}) @@ -221,9 +211,9 @@ func (o *FormulaAndFunctionMetricQueryDefinition) UnmarshalJSON(bytes []byte) (e return nil } o.Aggregator = all.Aggregator - o.DataSource = all.DataSource - o.Name = all.Name - o.Query = all.Query + o.DataSource = *all.DataSource + o.Name = *all.Name + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_formula_and_function_process_query_definition.go b/api/datadogV1/model_formula_and_function_process_query_definition.go index 6c2d665d659..8539a85c472 100644 --- a/api/datadogV1/model_formula_and_function_process_query_definition.go +++ b/api/datadogV1/model_formula_and_function_process_query_definition.go @@ -334,37 +334,18 @@ func (o FormulaAndFunctionProcessQueryDefinition) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionProcessQueryDataSource `json:"data_source"` - Metric *string `json:"metric"` - Name *string `json:"name"` - }{} all := struct { - Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` - DataSource FormulaAndFunctionProcessQueryDataSource `json:"data_source"` - IsNormalizedCpu *bool `json:"is_normalized_cpu,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Metric string `json:"metric"` - Name string `json:"name"` - Sort *QuerySortOrder `json:"sort,omitempty"` - TagFilters []string `json:"tag_filters,omitempty"` - TextFilter *string `json:"text_filter,omitempty"` + Aggregator *FormulaAndFunctionMetricAggregation `json:"aggregator,omitempty"` + DataSource *FormulaAndFunctionProcessQueryDataSource `json:"data_source"` + IsNormalizedCpu *bool `json:"is_normalized_cpu,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Metric *string `json:"metric"` + Name *string `json:"name"` + Sort *QuerySortOrder `json:"sort,omitempty"` + TagFilters []string `json:"tag_filters,omitempty"` + TextFilter *string `json:"text_filter,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Metric == nil { - return fmt.Errorf("required field metric missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -372,6 +353,15 @@ func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Metric == nil { + return fmt.Errorf("required field metric missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregator", "data_source", "is_normalized_cpu", "limit", "metric", "name", "sort", "tag_filters", "text_filter"}) @@ -403,11 +393,11 @@ func (o *FormulaAndFunctionProcessQueryDefinition) UnmarshalJSON(bytes []byte) ( return nil } o.Aggregator = all.Aggregator - o.DataSource = all.DataSource + o.DataSource = *all.DataSource o.IsNormalizedCpu = all.IsNormalizedCpu o.Limit = all.Limit - o.Metric = all.Metric - o.Name = all.Name + o.Metric = *all.Metric + o.Name = *all.Name o.Sort = all.Sort o.TagFilters = all.TagFilters o.TextFilter = all.TextFilter diff --git a/api/datadogV1/model_formula_and_function_slo_query_definition.go b/api/datadogV1/model_formula_and_function_slo_query_definition.go index 0025e826a12..48a990d245a 100644 --- a/api/datadogV1/model_formula_and_function_slo_query_definition.go +++ b/api/datadogV1/model_formula_and_function_slo_query_definition.go @@ -231,34 +231,15 @@ func (o FormulaAndFunctionSLOQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FormulaAndFunctionSLOQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DataSource *FormulaAndFunctionSLODataSource `json:"data_source"` - Measure *FormulaAndFunctionSLOMeasure `json:"measure"` - SloId *string `json:"slo_id"` - }{} all := struct { - DataSource FormulaAndFunctionSLODataSource `json:"data_source"` - GroupMode *FormulaAndFunctionSLOGroupMode `json:"group_mode,omitempty"` - Measure FormulaAndFunctionSLOMeasure `json:"measure"` - Name *string `json:"name,omitempty"` - SloId string `json:"slo_id"` - SloQueryType *FormulaAndFunctionSLOQueryType `json:"slo_query_type,omitempty"` + DataSource *FormulaAndFunctionSLODataSource `json:"data_source"` + GroupMode *FormulaAndFunctionSLOGroupMode `json:"group_mode,omitempty"` + Measure *FormulaAndFunctionSLOMeasure `json:"measure"` + Name *string `json:"name,omitempty"` + SloId *string `json:"slo_id"` + SloQueryType *FormulaAndFunctionSLOQueryType `json:"slo_query_type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Measure == nil { - return fmt.Errorf("required field measure missing") - } - if required.SloId == nil { - return fmt.Errorf("required field slo_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -266,6 +247,15 @@ func (o *FormulaAndFunctionSLOQueryDefinition) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Measure == nil { + return fmt.Errorf("required field measure missing") + } + if all.SloId == nil { + return fmt.Errorf("required field slo_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "group_mode", "measure", "name", "slo_id", "slo_query_type"}) @@ -304,11 +294,11 @@ func (o *FormulaAndFunctionSLOQueryDefinition) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } - o.DataSource = all.DataSource + o.DataSource = *all.DataSource o.GroupMode = all.GroupMode - o.Measure = all.Measure + o.Measure = *all.Measure o.Name = all.Name - o.SloId = all.SloId + o.SloId = *all.SloId o.SloQueryType = all.SloQueryType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_free_text_widget_definition.go b/api/datadogV1/model_free_text_widget_definition.go index 76571cfcbcd..f41061a24ca 100644 --- a/api/datadogV1/model_free_text_widget_definition.go +++ b/api/datadogV1/model_free_text_widget_definition.go @@ -206,29 +206,14 @@ func (o FreeTextWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Text *string `json:"text"` - Type *FreeTextWidgetDefinitionType `json:"type"` - }{} all := struct { - Color *string `json:"color,omitempty"` - FontSize *string `json:"font_size,omitempty"` - Text string `json:"text"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - Type FreeTextWidgetDefinitionType `json:"type"` + Color *string `json:"color,omitempty"` + FontSize *string `json:"font_size,omitempty"` + Text *string `json:"text"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + Type *FreeTextWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Text == nil { - return fmt.Errorf("required field text missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -236,6 +221,12 @@ func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Text == nil { + return fmt.Errorf("required field text missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"color", "font_size", "text", "text_align", "type"}) @@ -260,9 +251,9 @@ func (o *FreeTextWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.Color = all.Color o.FontSize = all.FontSize - o.Text = all.Text + o.Text = *all.Text o.TextAlign = all.TextAlign - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_funnel_query.go b/api/datadogV1/model_funnel_query.go index e0ac8918fe4..8f7ee045bf9 100644 --- a/api/datadogV1/model_funnel_query.go +++ b/api/datadogV1/model_funnel_query.go @@ -134,31 +134,12 @@ func (o FunnelQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { DataSource *FunnelSource `json:"data_source"` QueryString *string `json:"query_string"` Steps *[]FunnelStep `json:"steps"` }{} - all := struct { - DataSource FunnelSource `json:"data_source"` - QueryString string `json:"query_string"` - Steps []FunnelStep `json:"steps"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.QueryString == nil { - return fmt.Errorf("required field query_string missing") - } - if required.Steps == nil { - return fmt.Errorf("required field steps missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.QueryString == nil { + return fmt.Errorf("required field query_string missing") + } + if all.Steps == nil { + return fmt.Errorf("required field steps missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "query_string", "steps"}) @@ -180,9 +170,9 @@ func (o *FunnelQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.DataSource = all.DataSource - o.QueryString = all.QueryString - o.Steps = all.Steps + o.DataSource = *all.DataSource + o.QueryString = *all.QueryString + o.Steps = *all.Steps if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_funnel_step.go b/api/datadogV1/model_funnel_step.go index 32f7b6b238e..1b100a85862 100644 --- a/api/datadogV1/model_funnel_step.go +++ b/api/datadogV1/model_funnel_step.go @@ -105,26 +105,11 @@ func (o FunnelStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelStep) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Facet *string `json:"facet"` Value *string `json:"value"` }{} - all := struct { - Facet string `json:"facet"` - Value string `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - if required.Value == nil { - return fmt.Errorf("required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *FunnelStep) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "value"}) } else { return err } - o.Facet = all.Facet - o.Value = all.Value + o.Facet = *all.Facet + o.Value = *all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_funnel_widget_definition.go b/api/datadogV1/model_funnel_widget_definition.go index cda0665db81..e9a739f58d7 100644 --- a/api/datadogV1/model_funnel_widget_definition.go +++ b/api/datadogV1/model_funnel_widget_definition.go @@ -240,30 +240,15 @@ func (o FunnelWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]FunnelWidgetRequest `json:"requests"` - Type *FunnelWidgetDefinitionType `json:"type"` - }{} all := struct { - Requests []FunnelWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type FunnelWidgetDefinitionType `json:"type"` + Requests *[]FunnelWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *FunnelWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -271,6 +256,12 @@ func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"requests", "time", "title", "title_align", "title_size", "type"}) @@ -293,7 +284,7 @@ func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Requests = all.Requests + o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -305,7 +296,7 @@ func (o *FunnelWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_funnel_widget_request.go b/api/datadogV1/model_funnel_widget_request.go index daf20340286..b7aa2f0fd3d 100644 --- a/api/datadogV1/model_funnel_widget_request.go +++ b/api/datadogV1/model_funnel_widget_request.go @@ -105,26 +105,11 @@ func (o FunnelWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Query *FunnelQuery `json:"query"` RequestType *FunnelRequestType `json:"request_type"` }{} - all := struct { - Query FunnelQuery `json:"query"` - RequestType FunnelRequestType `json:"request_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.RequestType == nil { - return fmt.Errorf("required field request_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.RequestType == nil { + return fmt.Errorf("required field request_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query", "request_type"}) @@ -153,8 +144,8 @@ func (o *FunnelWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Query = all.Query - o.RequestType = all.RequestType + o.Query = *all.Query + o.RequestType = *all.RequestType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_gcp_account.go b/api/datadogV1/model_gcp_account.go index c8fccdc3a64..d30834fc0f1 100644 --- a/api/datadogV1/model_gcp_account.go +++ b/api/datadogV1/model_gcp_account.go @@ -534,8 +534,7 @@ func (o *GCPAccount) UnmarshalJSON(bytes []byte) (err error) { TokenUri *string `json:"token_uri,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_geomap_widget_definition.go b/api/datadogV1/model_geomap_widget_definition.go index 76b9f86e10d..c00121efbaf 100644 --- a/api/datadogV1/model_geomap_widget_definition.go +++ b/api/datadogV1/model_geomap_widget_definition.go @@ -329,48 +329,37 @@ func (o GeomapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]GeomapWidgetRequest `json:"requests"` - Style *GeomapWidgetDefinitionStyle `json:"style"` - Type *GeomapWidgetDefinitionType `json:"type"` - View *GeomapWidgetDefinitionView `json:"view"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []GeomapWidgetRequest `json:"requests"` - Style GeomapWidgetDefinitionStyle `json:"style"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type GeomapWidgetDefinitionType `json:"type"` - View GeomapWidgetDefinitionView `json:"view"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests *[]GeomapWidgetRequest `json:"requests"` + Style *GeomapWidgetDefinitionStyle `json:"style"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *GeomapWidgetDefinitionType `json:"type"` + View *GeomapWidgetDefinitionView `json:"view"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Requests == nil { + if all.Requests == nil { return fmt.Errorf("required field requests missing") } - if required.Style == nil { + if all.Style == nil { return fmt.Errorf("required field style missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - if required.View == nil { + if all.View == nil { return fmt.Errorf("required field view missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "requests", "style", "time", "title", "title_align", "title_size", "type", "view"}) @@ -394,7 +383,7 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.CustomLinks = all.CustomLinks - o.Requests = all.Requests + o.Requests = *all.Requests if all.Style.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -402,7 +391,7 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Style = all.Style + o.Style = *all.Style if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -414,7 +403,7 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if all.View.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -422,7 +411,7 @@ func (o *GeomapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.View = all.View + o.View = *all.View if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_geomap_widget_definition_style.go b/api/datadogV1/model_geomap_widget_definition_style.go index be3fbbaea2e..2a443abe058 100644 --- a/api/datadogV1/model_geomap_widget_definition_style.go +++ b/api/datadogV1/model_geomap_widget_definition_style.go @@ -105,26 +105,11 @@ func (o GeomapWidgetDefinitionStyle) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Palette *string `json:"palette"` PaletteFlip *bool `json:"palette_flip"` }{} - all := struct { - Palette string `json:"palette"` - PaletteFlip bool `json:"palette_flip"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Palette == nil { - return fmt.Errorf("required field palette missing") - } - if required.PaletteFlip == nil { - return fmt.Errorf("required field palette_flip missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *GeomapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Palette == nil { + return fmt.Errorf("required field palette missing") + } + if all.PaletteFlip == nil { + return fmt.Errorf("required field palette_flip missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"palette", "palette_flip"}) } else { return err } - o.Palette = all.Palette - o.PaletteFlip = all.PaletteFlip + o.Palette = *all.Palette + o.PaletteFlip = *all.PaletteFlip if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_geomap_widget_definition_view.go b/api/datadogV1/model_geomap_widget_definition_view.go index 39ea3027b2e..c6cb635d64d 100644 --- a/api/datadogV1/model_geomap_widget_definition_view.go +++ b/api/datadogV1/model_geomap_widget_definition_view.go @@ -78,21 +78,10 @@ func (o GeomapWidgetDefinitionView) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GeomapWidgetDefinitionView) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Focus *string `json:"focus"` - }{} all := struct { - Focus string `json:"focus"` + Focus *string `json:"focus"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Focus == nil { - return fmt.Errorf("required field focus missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *GeomapWidgetDefinitionView) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Focus == nil { + return fmt.Errorf("required field focus missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"focus"}) } else { return err } - o.Focus = all.Focus + o.Focus = *all.Focus if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_geomap_widget_request.go b/api/datadogV1/model_geomap_widget_request.go index c527ae80645..841447d74cf 100644 --- a/api/datadogV1/model_geomap_widget_request.go +++ b/api/datadogV1/model_geomap_widget_request.go @@ -290,8 +290,7 @@ func (o *GeomapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_graph_snapshot.go b/api/datadogV1/model_graph_snapshot.go index aa49b9df873..b9bb35d19ac 100644 --- a/api/datadogV1/model_graph_snapshot.go +++ b/api/datadogV1/model_graph_snapshot.go @@ -156,8 +156,7 @@ func (o *GraphSnapshot) UnmarshalJSON(bytes []byte) (err error) { MetricQuery *string `json:"metric_query,omitempty"` SnapshotUrl *string `json:"snapshot_url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_group_widget_definition.go b/api/datadogV1/model_group_widget_definition.go index c234c983957..a18a0b5bab5 100644 --- a/api/datadogV1/model_group_widget_definition.go +++ b/api/datadogV1/model_group_widget_definition.go @@ -303,36 +303,17 @@ func (o GroupWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - LayoutType *WidgetLayoutType `json:"layout_type"` - Type *GroupWidgetDefinitionType `json:"type"` - Widgets *[]Widget `json:"widgets"` - }{} all := struct { - BackgroundColor *string `json:"background_color,omitempty"` - BannerImg *string `json:"banner_img,omitempty"` - LayoutType WidgetLayoutType `json:"layout_type"` - ShowTitle *bool `json:"show_title,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - Type GroupWidgetDefinitionType `json:"type"` - Widgets []Widget `json:"widgets"` + BackgroundColor *string `json:"background_color,omitempty"` + BannerImg *string `json:"banner_img,omitempty"` + LayoutType *WidgetLayoutType `json:"layout_type"` + ShowTitle *bool `json:"show_title,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + Type *GroupWidgetDefinitionType `json:"type"` + Widgets *[]Widget `json:"widgets"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LayoutType == nil { - return fmt.Errorf("required field layout_type missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.Widgets == nil { - return fmt.Errorf("required field widgets missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -340,6 +321,15 @@ func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.LayoutType == nil { + return fmt.Errorf("required field layout_type missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Widgets == nil { + return fmt.Errorf("required field widgets missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"background_color", "banner_img", "layout_type", "show_title", "title", "title_align", "type", "widgets"}) @@ -372,12 +362,12 @@ func (o *GroupWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.BackgroundColor = all.BackgroundColor o.BannerImg = all.BannerImg - o.LayoutType = all.LayoutType + o.LayoutType = *all.LayoutType o.ShowTitle = all.ShowTitle o.Title = all.Title o.TitleAlign = all.TitleAlign - o.Type = all.Type - o.Widgets = all.Widgets + o.Type = *all.Type + o.Widgets = *all.Widgets if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_heat_map_widget_definition.go b/api/datadogV1/model_heat_map_widget_definition.go index fb3f5ed9deb..7159ab55f43 100644 --- a/api/datadogV1/model_heat_map_widget_definition.go +++ b/api/datadogV1/model_heat_map_widget_definition.go @@ -404,35 +404,20 @@ func (o HeatMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]HeatMapWidgetRequest `json:"requests"` - Type *HeatMapWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Events []WidgetEvent `json:"events,omitempty"` - LegendSize *string `json:"legend_size,omitempty"` - Requests []HeatMapWidgetRequest `json:"requests"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type HeatMapWidgetDefinitionType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Events []WidgetEvent `json:"events,omitempty"` + LegendSize *string `json:"legend_size,omitempty"` + Requests *[]HeatMapWidgetRequest `json:"requests"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *HeatMapWidgetDefinitionType `json:"type"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -440,6 +425,12 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "events", "legend_size", "requests", "show_legend", "time", "title", "title_align", "title_size", "type", "yaxis"}) @@ -465,7 +456,7 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.CustomLinks = all.CustomLinks o.Events = all.Events o.LegendSize = all.LegendSize - o.Requests = all.Requests + o.Requests = *all.Requests o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -478,7 +469,7 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_heat_map_widget_request.go b/api/datadogV1/model_heat_map_widget_request.go index b90ffc1f50b..3638add947c 100644 --- a/api/datadogV1/model_heat_map_widget_request.go +++ b/api/datadogV1/model_heat_map_widget_request.go @@ -392,8 +392,7 @@ func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` Style *WidgetStyle `json:"style,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host.go b/api/datadogV1/model_host.go index bce590b137b..1447bfdd034 100644 --- a/api/datadogV1/model_host.go +++ b/api/datadogV1/model_host.go @@ -539,8 +539,7 @@ func (o *Host) UnmarshalJSON(bytes []byte) (err error) { TagsBySource map[string][]string `json:"tags_by_source,omitempty"` Up *bool `json:"up,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_list_response.go b/api/datadogV1/model_host_list_response.go index f43518a62ef..33806f2360f 100644 --- a/api/datadogV1/model_host_list_response.go +++ b/api/datadogV1/model_host_list_response.go @@ -154,8 +154,7 @@ func (o *HostListResponse) UnmarshalJSON(bytes []byte) (err error) { TotalMatching *int64 `json:"total_matching,omitempty"` TotalReturned *int64 `json:"total_returned,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_map_request.go b/api/datadogV1/model_host_map_request.go index 221cd1e2478..d5b52cd2b91 100644 --- a/api/datadogV1/model_host_map_request.go +++ b/api/datadogV1/model_host_map_request.go @@ -358,8 +358,7 @@ func (o *HostMapRequest) UnmarshalJSON(bytes []byte) (err error) { RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_map_widget_definition.go b/api/datadogV1/model_host_map_widget_definition.go index 5b404149f65..b00c72dd08f 100644 --- a/api/datadogV1/model_host_map_widget_definition.go +++ b/api/datadogV1/model_host_map_widget_definition.go @@ -470,37 +470,22 @@ func (o HostMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *HostMapWidgetDefinitionRequests `json:"requests"` - Type *HostMapWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Group []string `json:"group,omitempty"` - NoGroupHosts *bool `json:"no_group_hosts,omitempty"` - NoMetricHosts *bool `json:"no_metric_hosts,omitempty"` - NodeType *WidgetNodeType `json:"node_type,omitempty"` - Notes *string `json:"notes,omitempty"` - Requests HostMapWidgetDefinitionRequests `json:"requests"` - Scope []string `json:"scope,omitempty"` - Style *HostMapWidgetDefinitionStyle `json:"style,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type HostMapWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Group []string `json:"group,omitempty"` + NoGroupHosts *bool `json:"no_group_hosts,omitempty"` + NoMetricHosts *bool `json:"no_metric_hosts,omitempty"` + NodeType *WidgetNodeType `json:"node_type,omitempty"` + Notes *string `json:"notes,omitempty"` + Requests *HostMapWidgetDefinitionRequests `json:"requests"` + Scope []string `json:"scope,omitempty"` + Style *HostMapWidgetDefinitionStyle `json:"style,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *HostMapWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -508,6 +493,12 @@ func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "group", "no_group_hosts", "no_metric_hosts", "node_type", "notes", "requests", "scope", "style", "title", "title_align", "title_size", "type"}) @@ -551,7 +542,7 @@ func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Requests = all.Requests + o.Requests = *all.Requests o.Scope = all.Scope if all.Style != nil && all.Style.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -564,7 +555,7 @@ func (o *HostMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_host_map_widget_definition_requests.go b/api/datadogV1/model_host_map_widget_definition_requests.go index 104ec0ae1b8..da96debc055 100644 --- a/api/datadogV1/model_host_map_widget_definition_requests.go +++ b/api/datadogV1/model_host_map_widget_definition_requests.go @@ -120,8 +120,7 @@ func (o *HostMapWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err error Fill *HostMapRequest `json:"fill,omitempty"` Size *HostMapRequest `json:"size,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_map_widget_definition_style.go b/api/datadogV1/model_host_map_widget_definition_style.go index fd5e7032eb7..866bf8d6e2e 100644 --- a/api/datadogV1/model_host_map_widget_definition_style.go +++ b/api/datadogV1/model_host_map_widget_definition_style.go @@ -188,8 +188,7 @@ func (o *HostMapWidgetDefinitionStyle) UnmarshalJSON(bytes []byte) (err error) { Palette *string `json:"palette,omitempty"` PaletteFlip *bool `json:"palette_flip,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_meta.go b/api/datadogV1/model_host_meta.go index 9b4361a3e55..f80ef23f4bd 100644 --- a/api/datadogV1/model_host_meta.go +++ b/api/datadogV1/model_host_meta.go @@ -562,8 +562,7 @@ func (o *HostMeta) UnmarshalJSON(bytes []byte) (err error) { SocketHostname *string `json:"socket-hostname,omitempty"` WinV []interface{} `json:"winV,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_meta_install_method.go b/api/datadogV1/model_host_meta_install_method.go index 5eeddf505ed..a1c0d0eaf4c 100644 --- a/api/datadogV1/model_host_meta_install_method.go +++ b/api/datadogV1/model_host_meta_install_method.go @@ -154,8 +154,7 @@ func (o *HostMetaInstallMethod) UnmarshalJSON(bytes []byte) (err error) { Tool *string `json:"tool,omitempty"` ToolVersion *string `json:"tool_version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_metrics.go b/api/datadogV1/model_host_metrics.go index 0dd915cb21f..65420901598 100644 --- a/api/datadogV1/model_host_metrics.go +++ b/api/datadogV1/model_host_metrics.go @@ -154,8 +154,7 @@ func (o *HostMetrics) UnmarshalJSON(bytes []byte) (err error) { Iowait *float64 `json:"iowait,omitempty"` Load *float64 `json:"load,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_mute_response.go b/api/datadogV1/model_host_mute_response.go index 33a71af6164..147a963557b 100644 --- a/api/datadogV1/model_host_mute_response.go +++ b/api/datadogV1/model_host_mute_response.go @@ -188,8 +188,7 @@ func (o *HostMuteResponse) UnmarshalJSON(bytes []byte) (err error) { Hostname *string `json:"hostname,omitempty"` Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_mute_settings.go b/api/datadogV1/model_host_mute_settings.go index bc43f218922..e3135c69eb3 100644 --- a/api/datadogV1/model_host_mute_settings.go +++ b/api/datadogV1/model_host_mute_settings.go @@ -154,8 +154,7 @@ func (o *HostMuteSettings) UnmarshalJSON(bytes []byte) (err error) { Message *string `json:"message,omitempty"` Override *bool `json:"override,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_tags.go b/api/datadogV1/model_host_tags.go index 75a93484e1f..b6413138a65 100644 --- a/api/datadogV1/model_host_tags.go +++ b/api/datadogV1/model_host_tags.go @@ -120,8 +120,7 @@ func (o *HostTags) UnmarshalJSON(bytes []byte) (err error) { Host *string `json:"host,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_host_totals.go b/api/datadogV1/model_host_totals.go index 7e8c4476a0b..49f90728a91 100644 --- a/api/datadogV1/model_host_totals.go +++ b/api/datadogV1/model_host_totals.go @@ -120,8 +120,7 @@ func (o *HostTotals) UnmarshalJSON(bytes []byte) (err error) { TotalActive *int64 `json:"total_active,omitempty"` TotalUp *int64 `json:"total_up,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_hourly_usage_attribution_body.go b/api/datadogV1/model_hourly_usage_attribution_body.go index 81ba54b7c1a..d5d7d86119f 100644 --- a/api/datadogV1/model_hourly_usage_attribution_body.go +++ b/api/datadogV1/model_hourly_usage_attribution_body.go @@ -368,8 +368,7 @@ func (o *HourlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { UpdatedAt *string `json:"updated_at,omitempty"` UsageType *HourlyUsageAttributionUsageType `json:"usage_type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_hourly_usage_attribution_metadata.go b/api/datadogV1/model_hourly_usage_attribution_metadata.go index e785c03fd7e..8c09d31500a 100644 --- a/api/datadogV1/model_hourly_usage_attribution_metadata.go +++ b/api/datadogV1/model_hourly_usage_attribution_metadata.go @@ -86,8 +86,7 @@ func (o *HourlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) all := struct { Pagination *HourlyUsageAttributionPagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_hourly_usage_attribution_pagination.go b/api/datadogV1/model_hourly_usage_attribution_pagination.go index 28d3eb6fc41..51bc2dad612 100644 --- a/api/datadogV1/model_hourly_usage_attribution_pagination.go +++ b/api/datadogV1/model_hourly_usage_attribution_pagination.go @@ -97,8 +97,7 @@ func (o *HourlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err erro all := struct { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_hourly_usage_attribution_response.go b/api/datadogV1/model_hourly_usage_attribution_response.go index 8d3bd61a1d1..b6bd890baed 100644 --- a/api/datadogV1/model_hourly_usage_attribution_response.go +++ b/api/datadogV1/model_hourly_usage_attribution_response.go @@ -120,8 +120,7 @@ func (o *HourlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) Metadata *HourlyUsageAttributionMetadata `json:"metadata,omitempty"` Usage []HourlyUsageAttributionBody `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_http_log_error.go b/api/datadogV1/model_http_log_error.go index 9e47c59cb57..986df0eebbf 100644 --- a/api/datadogV1/model_http_log_error.go +++ b/api/datadogV1/model_http_log_error.go @@ -105,26 +105,11 @@ func (o HTTPLogError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Code *int32 `json:"code"` Message *string `json:"message"` }{} - all := struct { - Code int32 `json:"code"` - Message string `json:"message"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Code == nil { - return fmt.Errorf("required field code missing") - } - if required.Message == nil { - return fmt.Errorf("required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Code == nil { + return fmt.Errorf("required field code missing") + } + if all.Message == nil { + return fmt.Errorf("required field message missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"code", "message"}) } else { return err } - o.Code = all.Code - o.Message = all.Message + o.Code = *all.Code + o.Message = *all.Message if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_http_log_item.go b/api/datadogV1/model_http_log_item.go index b67ecab6675..9826a66cf03 100644 --- a/api/datadogV1/model_http_log_item.go +++ b/api/datadogV1/model_http_log_item.go @@ -216,25 +216,14 @@ func (o HTTPLogItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - }{} all := struct { Ddsource *string `json:"ddsource,omitempty"` Ddtags *string `json:"ddtags,omitempty"` Hostname *string `json:"hostname,omitempty"` - Message string `json:"message"` + Message *string `json:"message"` Service *string `json:"service,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -242,6 +231,9 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Message == nil { + return fmt.Errorf("required field message missing") + } additionalProperties := make(map[string]string) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"ddsource", "ddtags", "hostname", "message", "service"}) @@ -251,7 +243,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { o.Ddsource = all.Ddsource o.Ddtags = all.Ddtags o.Hostname = all.Hostname - o.Message = all.Message + o.Message = *all.Message o.Service = all.Service if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_i_frame_widget_definition.go b/api/datadogV1/model_i_frame_widget_definition.go index 227ba90149e..67d8bd3f40b 100644 --- a/api/datadogV1/model_i_frame_widget_definition.go +++ b/api/datadogV1/model_i_frame_widget_definition.go @@ -107,26 +107,11 @@ func (o IFrameWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Type *IFrameWidgetDefinitionType `json:"type"` Url *string `json:"url"` }{} - all := struct { - Type IFrameWidgetDefinitionType `json:"type"` - Url string `json:"url"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"type", "url"}) @@ -148,8 +139,8 @@ func (o *IFrameWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Type = all.Type - o.Url = all.Url + o.Type = *all.Type + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_idp_form_data.go b/api/datadogV1/model_idp_form_data.go index 756fabbee3e..d51c7e4e5b3 100644 --- a/api/datadogV1/model_idp_form_data.go +++ b/api/datadogV1/model_idp_form_data.go @@ -79,21 +79,10 @@ func (o IdpFormData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IdpFormData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - IdpFile **os.File `json:"idp_file"` - }{} all := struct { - IdpFile *os.File `json:"idp_file"` + IdpFile **os.File `json:"idp_file"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IdpFile == nil { - return fmt.Errorf("required field idp_file missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -101,13 +90,16 @@ func (o *IdpFormData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.IdpFile == nil { + return fmt.Errorf("required field idp_file missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"idp_file"}) } else { return err } - o.IdpFile = all.IdpFile + o.IdpFile = *all.IdpFile if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_idp_response.go b/api/datadogV1/model_idp_response.go index 724f2831940..76faed767e0 100644 --- a/api/datadogV1/model_idp_response.go +++ b/api/datadogV1/model_idp_response.go @@ -78,21 +78,10 @@ func (o IdpResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IdpResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - }{} all := struct { - Message string `json:"message"` + Message *string `json:"message"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *IdpResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Message == nil { + return fmt.Errorf("required field message missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"message"}) } else { return err } - o.Message = all.Message + o.Message = *all.Message if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_image_widget_definition.go b/api/datadogV1/model_image_widget_definition.go index ded10f5cd64..49acee53138 100644 --- a/api/datadogV1/model_image_widget_definition.go +++ b/api/datadogV1/model_image_widget_definition.go @@ -348,33 +348,18 @@ func (o ImageWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *ImageWidgetDefinitionType `json:"type"` - Url *string `json:"url"` - }{} all := struct { - HasBackground *bool `json:"has_background,omitempty"` - HasBorder *bool `json:"has_border,omitempty"` - HorizontalAlign *WidgetHorizontalAlign `json:"horizontal_align,omitempty"` - Margin *WidgetMargin `json:"margin,omitempty"` - Sizing *WidgetImageSizing `json:"sizing,omitempty"` - Type ImageWidgetDefinitionType `json:"type"` - Url string `json:"url"` - UrlDarkTheme *string `json:"url_dark_theme,omitempty"` - VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` + HasBackground *bool `json:"has_background,omitempty"` + HasBorder *bool `json:"has_border,omitempty"` + HorizontalAlign *WidgetHorizontalAlign `json:"horizontal_align,omitempty"` + Margin *WidgetMargin `json:"margin,omitempty"` + Sizing *WidgetImageSizing `json:"sizing,omitempty"` + Type *ImageWidgetDefinitionType `json:"type"` + Url *string `json:"url"` + UrlDarkTheme *string `json:"url_dark_theme,omitempty"` + VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -382,6 +367,12 @@ func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"has_background", "has_border", "horizontal_align", "margin", "sizing", "type", "url", "url_dark_theme", "vertical_align"}) @@ -433,8 +424,8 @@ func (o *ImageWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.HorizontalAlign = all.HorizontalAlign o.Margin = all.Margin o.Sizing = all.Sizing - o.Type = all.Type - o.Url = all.Url + o.Type = *all.Type + o.Url = *all.Url o.UrlDarkTheme = all.UrlDarkTheme o.VerticalAlign = all.VerticalAlign if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_intake_payload_accepted.go b/api/datadogV1/model_intake_payload_accepted.go index 6eef03ca604..6de5da6eb10 100644 --- a/api/datadogV1/model_intake_payload_accepted.go +++ b/api/datadogV1/model_intake_payload_accepted.go @@ -86,8 +86,7 @@ func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { all := struct { Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_agents.go b/api/datadogV1/model_ip_prefixes_agents.go index 88df4e75c36..cf3445bafa4 100644 --- a/api/datadogV1/model_ip_prefixes_agents.go +++ b/api/datadogV1/model_ip_prefixes_agents.go @@ -120,8 +120,7 @@ func (o *IPPrefixesAgents) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_api.go b/api/datadogV1/model_ip_prefixes_api.go index f7f6f62c8ee..99a7d5e62f6 100644 --- a/api/datadogV1/model_ip_prefixes_api.go +++ b/api/datadogV1/model_ip_prefixes_api.go @@ -120,8 +120,7 @@ func (o *IPPrefixesAPI) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_apm.go b/api/datadogV1/model_ip_prefixes_apm.go index 516b9c94f01..a5a737b51a1 100644 --- a/api/datadogV1/model_ip_prefixes_apm.go +++ b/api/datadogV1/model_ip_prefixes_apm.go @@ -120,8 +120,7 @@ func (o *IPPrefixesAPM) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_logs.go b/api/datadogV1/model_ip_prefixes_logs.go index 966e9b21f51..19659b45880 100644 --- a/api/datadogV1/model_ip_prefixes_logs.go +++ b/api/datadogV1/model_ip_prefixes_logs.go @@ -120,8 +120,7 @@ func (o *IPPrefixesLogs) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_orchestrator.go b/api/datadogV1/model_ip_prefixes_orchestrator.go index 9ebd975e8e8..88e2d38f079 100644 --- a/api/datadogV1/model_ip_prefixes_orchestrator.go +++ b/api/datadogV1/model_ip_prefixes_orchestrator.go @@ -120,8 +120,7 @@ func (o *IPPrefixesOrchestrator) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_process.go b/api/datadogV1/model_ip_prefixes_process.go index 3e98502c989..f56bb60a1c0 100644 --- a/api/datadogV1/model_ip_prefixes_process.go +++ b/api/datadogV1/model_ip_prefixes_process.go @@ -120,8 +120,7 @@ func (o *IPPrefixesProcess) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_synthetics.go b/api/datadogV1/model_ip_prefixes_synthetics.go index 9876fda7bc2..175665e319c 100644 --- a/api/datadogV1/model_ip_prefixes_synthetics.go +++ b/api/datadogV1/model_ip_prefixes_synthetics.go @@ -188,8 +188,7 @@ func (o *IPPrefixesSynthetics) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` PrefixesIpv6ByLocation map[string][]string `json:"prefixes_ipv6_by_location,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go b/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go index b2473a787ce..5ce9344a5d7 100644 --- a/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go +++ b/api/datadogV1/model_ip_prefixes_synthetics_private_locations.go @@ -120,8 +120,7 @@ func (o *IPPrefixesSyntheticsPrivateLocations) UnmarshalJSON(bytes []byte) (err PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_prefixes_webhooks.go b/api/datadogV1/model_ip_prefixes_webhooks.go index 4415f961c5d..580c2e5d3f6 100644 --- a/api/datadogV1/model_ip_prefixes_webhooks.go +++ b/api/datadogV1/model_ip_prefixes_webhooks.go @@ -120,8 +120,7 @@ func (o *IPPrefixesWebhooks) UnmarshalJSON(bytes []byte) (err error) { PrefixesIpv4 []string `json:"prefixes_ipv4,omitempty"` PrefixesIpv6 []string `json:"prefixes_ipv6,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_ip_ranges.go b/api/datadogV1/model_ip_ranges.go index bd812bf0cda..366f505399c 100644 --- a/api/datadogV1/model_ip_ranges.go +++ b/api/datadogV1/model_ip_ranges.go @@ -426,8 +426,7 @@ func (o *IPRanges) UnmarshalJSON(bytes []byte) (err error) { Version *int64 `json:"version,omitempty"` Webhooks *IPPrefixesWebhooks `json:"webhooks,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_list_stream_column.go b/api/datadogV1/model_list_stream_column.go index 7771e2d93cb..bc568b7c0a6 100644 --- a/api/datadogV1/model_list_stream_column.go +++ b/api/datadogV1/model_list_stream_column.go @@ -105,26 +105,11 @@ func (o ListStreamColumn) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Field *string `json:"field"` Width *ListStreamColumnWidth `json:"width"` }{} - all := struct { - Field string `json:"field"` - Width ListStreamColumnWidth `json:"width"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Field == nil { - return fmt.Errorf("required field field missing") - } - if required.Width == nil { - return fmt.Errorf("required field width missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Field == nil { + return fmt.Errorf("required field field missing") + } + if all.Width == nil { + return fmt.Errorf("required field width missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"field", "width"}) @@ -146,8 +137,8 @@ func (o *ListStreamColumn) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Field = all.Field - o.Width = all.Width + o.Field = *all.Field + o.Width = *all.Width if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_list_stream_compute_items.go b/api/datadogV1/model_list_stream_compute_items.go index 5bf10606f7e..3cebddcffe6 100644 --- a/api/datadogV1/model_list_stream_compute_items.go +++ b/api/datadogV1/model_list_stream_compute_items.go @@ -111,22 +111,11 @@ func (o ListStreamComputeItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamComputeItems) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *ListStreamComputeAggregation `json:"aggregation"` - }{} all := struct { - Aggregation ListStreamComputeAggregation `json:"aggregation"` - Facet *string `json:"facet,omitempty"` + Aggregation *ListStreamComputeAggregation `json:"aggregation"` + Facet *string `json:"facet,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *ListStreamComputeItems) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "facet"}) @@ -148,7 +140,7 @@ func (o *ListStreamComputeItems) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Facet = all.Facet if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_list_stream_group_by_items.go b/api/datadogV1/model_list_stream_group_by_items.go index 3bfdad77f06..6592b75db7a 100644 --- a/api/datadogV1/model_list_stream_group_by_items.go +++ b/api/datadogV1/model_list_stream_group_by_items.go @@ -78,21 +78,10 @@ func (o ListStreamGroupByItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamGroupByItems) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *ListStreamGroupByItems) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_list_stream_query.go b/api/datadogV1/model_list_stream_query.go index 92a5c64739b..c4119982e2b 100644 --- a/api/datadogV1/model_list_stream_query.go +++ b/api/datadogV1/model_list_stream_query.go @@ -305,32 +305,17 @@ func (o ListStreamQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DataSource *ListStreamSource `json:"data_source"` - QueryString *string `json:"query_string"` - }{} all := struct { Compute []ListStreamComputeItems `json:"compute,omitempty"` - DataSource ListStreamSource `json:"data_source"` + DataSource *ListStreamSource `json:"data_source"` EventSize *WidgetEventSize `json:"event_size,omitempty"` GroupBy []ListStreamGroupByItems `json:"group_by,omitempty"` Indexes []string `json:"indexes,omitempty"` - QueryString string `json:"query_string"` + QueryString *string `json:"query_string"` Sort *WidgetFieldSort `json:"sort,omitempty"` Storage *string `json:"storage,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.QueryString == nil { - return fmt.Errorf("required field query_string missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -338,6 +323,12 @@ func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.QueryString == nil { + return fmt.Errorf("required field query_string missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "data_source", "event_size", "group_by", "indexes", "query_string", "sort", "storage"}) @@ -361,11 +352,11 @@ func (o *ListStreamQuery) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Compute = all.Compute - o.DataSource = all.DataSource + o.DataSource = *all.DataSource o.EventSize = all.EventSize o.GroupBy = all.GroupBy o.Indexes = all.Indexes - o.QueryString = all.QueryString + o.QueryString = *all.QueryString if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_list_stream_widget_definition.go b/api/datadogV1/model_list_stream_widget_definition.go index 5df417205d7..9d7d208bdb2 100644 --- a/api/datadogV1/model_list_stream_widget_definition.go +++ b/api/datadogV1/model_list_stream_widget_definition.go @@ -307,32 +307,17 @@ func (o ListStreamWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]ListStreamWidgetRequest `json:"requests"` - Type *ListStreamWidgetDefinitionType `json:"type"` - }{} all := struct { - LegendSize *string `json:"legend_size,omitempty"` - Requests []ListStreamWidgetRequest `json:"requests"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ListStreamWidgetDefinitionType `json:"type"` + LegendSize *string `json:"legend_size,omitempty"` + Requests *[]ListStreamWidgetRequest `json:"requests"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *ListStreamWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -340,6 +325,12 @@ func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"legend_size", "requests", "show_legend", "time", "title", "title_align", "title_size", "type"}) @@ -363,7 +354,7 @@ func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.LegendSize = all.LegendSize - o.Requests = all.Requests + o.Requests = *all.Requests o.ShowLegend = all.ShowLegend if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -376,7 +367,7 @@ func (o *ListStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_list_stream_widget_request.go b/api/datadogV1/model_list_stream_widget_request.go index 120948ee37f..4caa3f1690e 100644 --- a/api/datadogV1/model_list_stream_widget_request.go +++ b/api/datadogV1/model_list_stream_widget_request.go @@ -132,31 +132,12 @@ func (o ListStreamWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Columns *[]ListStreamColumn `json:"columns"` Query *ListStreamQuery `json:"query"` ResponseFormat *ListStreamResponseFormat `json:"response_format"` }{} - all := struct { - Columns []ListStreamColumn `json:"columns"` - Query ListStreamQuery `json:"query"` - ResponseFormat ListStreamResponseFormat `json:"response_format"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Columns == nil { - return fmt.Errorf("required field columns missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.ResponseFormat == nil { - return fmt.Errorf("required field response_format missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -164,6 +145,15 @@ func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Columns == nil { + return fmt.Errorf("required field columns missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.ResponseFormat == nil { + return fmt.Errorf("required field response_format missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"columns", "query", "response_format"}) @@ -178,7 +168,7 @@ func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Columns = all.Columns + o.Columns = *all.Columns if all.Query.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -186,8 +176,8 @@ func (o *ListStreamWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Query = all.Query - o.ResponseFormat = all.ResponseFormat + o.Query = *all.Query + o.ResponseFormat = *all.ResponseFormat if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_log.go b/api/datadogV1/model_log.go index a59c5c179a3..19234b0c5d7 100644 --- a/api/datadogV1/model_log.go +++ b/api/datadogV1/model_log.go @@ -120,8 +120,7 @@ func (o *Log) UnmarshalJSON(bytes []byte) (err error) { Content *LogContent `json:"content,omitempty"` Id *string `json:"id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_log_content.go b/api/datadogV1/model_log_content.go index c803a1f233d..afbe84aa143 100644 --- a/api/datadogV1/model_log_content.go +++ b/api/datadogV1/model_log_content.go @@ -265,8 +265,7 @@ func (o *LogContent) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_log_query_definition.go b/api/datadogV1/model_log_query_definition.go index 87d0cc5c113..9be51ecc242 100644 --- a/api/datadogV1/model_log_query_definition.go +++ b/api/datadogV1/model_log_query_definition.go @@ -222,8 +222,7 @@ func (o *LogQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { MultiCompute []LogsQueryCompute `json:"multi_compute,omitempty"` Search *LogQueryDefinitionSearch `json:"search,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_log_query_definition_group_by.go b/api/datadogV1/model_log_query_definition_group_by.go index f89f7500e88..940becb91a0 100644 --- a/api/datadogV1/model_log_query_definition_group_by.go +++ b/api/datadogV1/model_log_query_definition_group_by.go @@ -144,23 +144,12 @@ func (o LogQueryDefinitionGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinitionGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Limit *int64 `json:"limit,omitempty"` Sort *LogQueryDefinitionGroupBySort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *LogQueryDefinitionGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "limit", "sort"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_log_query_definition_group_by_sort.go b/api/datadogV1/model_log_query_definition_group_by_sort.go index 48e3af5cf69..e53dce11534 100644 --- a/api/datadogV1/model_log_query_definition_group_by_sort.go +++ b/api/datadogV1/model_log_query_definition_group_by_sort.go @@ -138,27 +138,12 @@ func (o LogQueryDefinitionGroupBySort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Aggregation *string `json:"aggregation"` + Facet *string `json:"facet,omitempty"` Order *WidgetSort `json:"order"` }{} - all := struct { - Aggregation string `json:"aggregation"` - Facet *string `json:"facet,omitempty"` - Order WidgetSort `json:"order"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - if required.Order == nil { - return fmt.Errorf("required field order missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } + if all.Order == nil { + return fmt.Errorf("required field order missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "facet", "order"}) @@ -180,9 +171,9 @@ func (o *LogQueryDefinitionGroupBySort) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Facet = all.Facet - o.Order = all.Order + o.Order = *all.Order if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_log_query_definition_search.go b/api/datadogV1/model_log_query_definition_search.go index 54b89d813d7..6635a4257ab 100644 --- a/api/datadogV1/model_log_query_definition_search.go +++ b/api/datadogV1/model_log_query_definition_search.go @@ -78,21 +78,10 @@ func (o LogQueryDefinitionSearch) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} all := struct { - Query string `json:"query"` + Query *string `json:"query"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *LogQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query"}) } else { return err } - o.Query = all.Query + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_log_stream_widget_definition.go b/api/datadogV1/model_log_stream_widget_definition.go index 53fb07c98c5..903d0bf1bad 100644 --- a/api/datadogV1/model_log_stream_widget_definition.go +++ b/api/datadogV1/model_log_stream_widget_definition.go @@ -480,33 +480,22 @@ func (o LogStreamWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *LogStreamWidgetDefinitionType `json:"type"` - }{} all := struct { - Columns []string `json:"columns,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Logset *string `json:"logset,omitempty"` - MessageDisplay *WidgetMessageDisplay `json:"message_display,omitempty"` - Query *string `json:"query,omitempty"` - ShowDateColumn *bool `json:"show_date_column,omitempty"` - ShowMessageColumn *bool `json:"show_message_column,omitempty"` - Sort *WidgetFieldSort `json:"sort,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type LogStreamWidgetDefinitionType `json:"type"` + Columns []string `json:"columns,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Logset *string `json:"logset,omitempty"` + MessageDisplay *WidgetMessageDisplay `json:"message_display,omitempty"` + Query *string `json:"query,omitempty"` + ShowDateColumn *bool `json:"show_date_column,omitempty"` + ShowMessageColumn *bool `json:"show_message_column,omitempty"` + Sort *WidgetFieldSort `json:"sort,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *LogStreamWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -514,6 +503,9 @@ func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"columns", "indexes", "logset", "message_display", "query", "show_date_column", "show_message_column", "sort", "time", "title", "title_align", "title_size", "type"}) @@ -570,7 +562,7 @@ func (o *LogStreamWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_api_error.go b/api/datadogV1/model_logs_api_error.go index c0731a72bb2..2d284883060 100644 --- a/api/datadogV1/model_logs_api_error.go +++ b/api/datadogV1/model_logs_api_error.go @@ -154,8 +154,7 @@ func (o *LogsAPIError) UnmarshalJSON(bytes []byte) (err error) { Details []LogsAPIError `json:"details,omitempty"` Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_api_error_response.go b/api/datadogV1/model_logs_api_error_response.go index b8c7e9ef6af..ab9636ecff9 100644 --- a/api/datadogV1/model_logs_api_error_response.go +++ b/api/datadogV1/model_logs_api_error_response.go @@ -86,8 +86,7 @@ func (o *LogsAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Error *LogsAPIError `json:"error,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_arithmetic_processor.go b/api/datadogV1/model_logs_arithmetic_processor.go index c9bfff5bc55..76c13420e65 100644 --- a/api/datadogV1/model_logs_arithmetic_processor.go +++ b/api/datadogV1/model_logs_arithmetic_processor.go @@ -262,34 +262,15 @@ func (o LogsArithmeticProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Expression *string `json:"expression"` - Target *string `json:"target"` - Type *LogsArithmeticProcessorType `json:"type"` - }{} all := struct { - Expression string `json:"expression"` - IsEnabled *bool `json:"is_enabled,omitempty"` - IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` - Name *string `json:"name,omitempty"` - Target string `json:"target"` - Type LogsArithmeticProcessorType `json:"type"` + Expression *string `json:"expression"` + IsEnabled *bool `json:"is_enabled,omitempty"` + IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` + Name *string `json:"name,omitempty"` + Target *string `json:"target"` + Type *LogsArithmeticProcessorType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Expression == nil { - return fmt.Errorf("required field expression missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -297,6 +278,15 @@ func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Expression == nil { + return fmt.Errorf("required field expression missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"expression", "is_enabled", "is_replace_missing", "name", "target", "type"}) @@ -311,12 +301,12 @@ func (o *LogsArithmeticProcessor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Expression = all.Expression + o.Expression = *all.Expression o.IsEnabled = all.IsEnabled o.IsReplaceMissing = all.IsReplaceMissing o.Name = all.Name - o.Target = all.Target - o.Type = all.Type + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_attribute_remapper.go b/api/datadogV1/model_logs_attribute_remapper.go index a34e68798d5..81bf018527a 100644 --- a/api/datadogV1/model_logs_attribute_remapper.go +++ b/api/datadogV1/model_logs_attribute_remapper.go @@ -389,38 +389,19 @@ func (o LogsAttributeRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsAttributeRemapperType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - OverrideOnConflict *bool `json:"override_on_conflict,omitempty"` - PreserveSource *bool `json:"preserve_source,omitempty"` - SourceType *string `json:"source_type,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - TargetFormat *TargetFormatType `json:"target_format,omitempty"` - TargetType *string `json:"target_type,omitempty"` - Type LogsAttributeRemapperType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + OverrideOnConflict *bool `json:"override_on_conflict,omitempty"` + PreserveSource *bool `json:"preserve_source,omitempty"` + SourceType *string `json:"source_type,omitempty"` + Sources *[]string `json:"sources"` + Target *string `json:"target"` + TargetFormat *TargetFormatType `json:"target_format,omitempty"` + TargetType *string `json:"target_type,omitempty"` + Type *LogsAttributeRemapperType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -428,6 +409,15 @@ func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "override_on_conflict", "preserve_source", "source_type", "sources", "target", "target_format", "target_type", "type"}) @@ -455,11 +445,11 @@ func (o *LogsAttributeRemapper) UnmarshalJSON(bytes []byte) (err error) { o.OverrideOnConflict = all.OverrideOnConflict o.PreserveSource = all.PreserveSource o.SourceType = all.SourceType - o.Sources = all.Sources - o.Target = all.Target + o.Sources = *all.Sources + o.Target = *all.Target o.TargetFormat = all.TargetFormat o.TargetType = all.TargetType - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_by_retention.go b/api/datadogV1/model_logs_by_retention.go index 6e623b53425..61f7a360c7a 100644 --- a/api/datadogV1/model_logs_by_retention.go +++ b/api/datadogV1/model_logs_by_retention.go @@ -154,8 +154,7 @@ func (o *LogsByRetention) UnmarshalJSON(bytes []byte) (err error) { Usage []LogsRetentionAggSumUsage `json:"usage,omitempty"` UsageByMonth *LogsByRetentionMonthlyUsage `json:"usage_by_month,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_by_retention_monthly_usage.go b/api/datadogV1/model_logs_by_retention_monthly_usage.go index 347a0f2fd2d..14facb79915 100644 --- a/api/datadogV1/model_logs_by_retention_monthly_usage.go +++ b/api/datadogV1/model_logs_by_retention_monthly_usage.go @@ -125,8 +125,7 @@ func (o *LogsByRetentionMonthlyUsage) UnmarshalJSON(bytes []byte) (err error) { Date *time.Time `json:"date,omitempty"` Usage []LogsRetentionSumUsage `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_by_retention_org_usage.go b/api/datadogV1/model_logs_by_retention_org_usage.go index 930f8243449..e5ee5f48861 100644 --- a/api/datadogV1/model_logs_by_retention_org_usage.go +++ b/api/datadogV1/model_logs_by_retention_org_usage.go @@ -86,8 +86,7 @@ func (o *LogsByRetentionOrgUsage) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []LogsRetentionSumUsage `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_by_retention_orgs.go b/api/datadogV1/model_logs_by_retention_orgs.go index 6f89cd05f65..ca4eab7f795 100644 --- a/api/datadogV1/model_logs_by_retention_orgs.go +++ b/api/datadogV1/model_logs_by_retention_orgs.go @@ -86,8 +86,7 @@ func (o *LogsByRetentionOrgs) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []LogsByRetentionOrgUsage `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_category_processor.go b/api/datadogV1/model_logs_category_processor.go index ccef7b08b94..3693496a363 100644 --- a/api/datadogV1/model_logs_category_processor.go +++ b/api/datadogV1/model_logs_category_processor.go @@ -217,33 +217,14 @@ func (o LogsCategoryProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Categories *[]LogsCategoryProcessorCategory `json:"categories"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` Target *string `json:"target"` Type *LogsCategoryProcessorType `json:"type"` }{} - all := struct { - Categories []LogsCategoryProcessorCategory `json:"categories"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Target string `json:"target"` - Type LogsCategoryProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Categories == nil { - return fmt.Errorf("required field categories missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -251,6 +232,15 @@ func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Categories == nil { + return fmt.Errorf("required field categories missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"categories", "is_enabled", "name", "target", "type"}) @@ -265,11 +255,11 @@ func (o *LogsCategoryProcessor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Categories = all.Categories + o.Categories = *all.Categories o.IsEnabled = all.IsEnabled o.Name = all.Name - o.Target = all.Target - o.Type = all.Type + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_category_processor_category.go b/api/datadogV1/model_logs_category_processor_category.go index a5f2ace0f29..1ab86b73a87 100644 --- a/api/datadogV1/model_logs_category_processor_category.go +++ b/api/datadogV1/model_logs_category_processor_category.go @@ -120,8 +120,7 @@ func (o *LogsCategoryProcessorCategory) UnmarshalJSON(bytes []byte) (err error) Filter *LogsFilter `json:"filter,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_date_remapper.go b/api/datadogV1/model_logs_date_remapper.go index fad15f20863..03a21f8edbf 100644 --- a/api/datadogV1/model_logs_date_remapper.go +++ b/api/datadogV1/model_logs_date_remapper.go @@ -195,28 +195,13 @@ func (o LogsDateRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsDateRemapperType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsDateRemapperType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources *[]string `json:"sources"` + Type *LogsDateRemapperType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -224,6 +209,12 @@ func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "sources", "type"}) @@ -240,8 +231,8 @@ func (o *LogsDateRemapper) UnmarshalJSON(bytes []byte) (err error) { } o.IsEnabled = all.IsEnabled o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type + o.Sources = *all.Sources + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_exclusion.go b/api/datadogV1/model_logs_exclusion.go index 8085b11f2d2..c7dab8f874e 100644 --- a/api/datadogV1/model_logs_exclusion.go +++ b/api/datadogV1/model_logs_exclusion.go @@ -144,23 +144,12 @@ func (o LogsExclusion) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Filter *LogsExclusionFilter `json:"filter,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"filter", "is_enabled", "name"}) @@ -183,7 +175,7 @@ func (o *LogsExclusion) UnmarshalJSON(bytes []byte) (err error) { } o.Filter = all.Filter o.IsEnabled = all.IsEnabled - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_exclusion_filter.go b/api/datadogV1/model_logs_exclusion_filter.go index 595b7a768ce..6f2ec68224d 100644 --- a/api/datadogV1/model_logs_exclusion_filter.go +++ b/api/datadogV1/model_logs_exclusion_filter.go @@ -113,22 +113,11 @@ func (o LogsExclusionFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - SampleRate *float64 `json:"sample_rate"` - }{} all := struct { - Query *string `json:"query,omitempty"` - SampleRate float64 `json:"sample_rate"` + Query *string `json:"query,omitempty"` + SampleRate *float64 `json:"sample_rate"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.SampleRate == nil { - return fmt.Errorf("required field sample_rate missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -136,6 +125,9 @@ func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.SampleRate == nil { + return fmt.Errorf("required field sample_rate missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query", "sample_rate"}) @@ -143,7 +135,7 @@ func (o *LogsExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { return err } o.Query = all.Query - o.SampleRate = all.SampleRate + o.SampleRate = *all.SampleRate if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_filter.go b/api/datadogV1/model_logs_filter.go index acfbc8d61f0..a88bcd8274e 100644 --- a/api/datadogV1/model_logs_filter.go +++ b/api/datadogV1/model_logs_filter.go @@ -86,8 +86,7 @@ func (o *LogsFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_geo_ip_parser.go b/api/datadogV1/model_logs_geo_ip_parser.go index 789962184d9..48f922fdc83 100644 --- a/api/datadogV1/model_logs_geo_ip_parser.go +++ b/api/datadogV1/model_logs_geo_ip_parser.go @@ -207,33 +207,14 @@ func (o LogsGeoIPParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsGeoIPParserType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - Type LogsGeoIPParserType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsGeoIPParserType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -241,6 +222,15 @@ func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "sources", "target", "type"}) @@ -257,9 +247,9 @@ func (o *LogsGeoIPParser) UnmarshalJSON(bytes []byte) (err error) { } o.IsEnabled = all.IsEnabled o.Name = all.Name - o.Sources = all.Sources - o.Target = all.Target - o.Type = all.Type + o.Sources = *all.Sources + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_grok_parser.go b/api/datadogV1/model_logs_grok_parser.go index 61b7b4d2c2c..4f3cac8926b 100644 --- a/api/datadogV1/model_logs_grok_parser.go +++ b/api/datadogV1/model_logs_grok_parser.go @@ -240,34 +240,15 @@ func (o LogsGrokParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Grok *LogsGrokParserRules `json:"grok"` - Source *string `json:"source"` - Type *LogsGrokParserType `json:"type"` - }{} all := struct { - Grok LogsGrokParserRules `json:"grok"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Samples []string `json:"samples,omitempty"` - Source string `json:"source"` - Type LogsGrokParserType `json:"type"` + Grok *LogsGrokParserRules `json:"grok"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Samples []string `json:"samples,omitempty"` + Source *string `json:"source"` + Type *LogsGrokParserType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Grok == nil { - return fmt.Errorf("required field grok missing") - } - if required.Source == nil { - return fmt.Errorf("required field source missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -275,6 +256,15 @@ func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Grok == nil { + return fmt.Errorf("required field grok missing") + } + if all.Source == nil { + return fmt.Errorf("required field source missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"grok", "is_enabled", "name", "samples", "source", "type"}) @@ -296,12 +286,12 @@ func (o *LogsGrokParser) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Grok = all.Grok + o.Grok = *all.Grok o.IsEnabled = all.IsEnabled o.Name = all.Name o.Samples = all.Samples - o.Source = all.Source - o.Type = all.Type + o.Source = *all.Source + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_grok_parser_rules.go b/api/datadogV1/model_logs_grok_parser_rules.go index 5562df21371..0d2dcfb3fe8 100644 --- a/api/datadogV1/model_logs_grok_parser_rules.go +++ b/api/datadogV1/model_logs_grok_parser_rules.go @@ -115,22 +115,11 @@ func (o LogsGrokParserRules) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGrokParserRules) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - MatchRules *string `json:"match_rules"` - }{} all := struct { - MatchRules string `json:"match_rules"` + MatchRules *string `json:"match_rules"` SupportRules *string `json:"support_rules,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.MatchRules == nil { - return fmt.Errorf("required field match_rules missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -138,13 +127,16 @@ func (o *LogsGrokParserRules) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.MatchRules == nil { + return fmt.Errorf("required field match_rules missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"match_rules", "support_rules"}) } else { return err } - o.MatchRules = all.MatchRules + o.MatchRules = *all.MatchRules o.SupportRules = all.SupportRules if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_logs_index.go b/api/datadogV1/model_logs_index.go index ed73755a212..c00fa1fa282 100644 --- a/api/datadogV1/model_logs_index.go +++ b/api/datadogV1/model_logs_index.go @@ -241,30 +241,15 @@ func (o LogsIndex) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Filter *LogsFilter `json:"filter"` - Name *string `json:"name"` - }{} all := struct { DailyLimit *int64 `json:"daily_limit,omitempty"` ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` - Filter LogsFilter `json:"filter"` + Filter *LogsFilter `json:"filter"` IsRateLimited *bool `json:"is_rate_limited,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` NumRetentionDays *int64 `json:"num_retention_days,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Filter == nil { - return fmt.Errorf("required field filter missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -272,6 +257,12 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Filter == nil { + return fmt.Errorf("required field filter missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"daily_limit", "exclusion_filters", "filter", "is_rate_limited", "name", "num_retention_days"}) @@ -287,9 +278,9 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Filter = all.Filter + o.Filter = *all.Filter o.IsRateLimited = all.IsRateLimited - o.Name = all.Name + o.Name = *all.Name o.NumRetentionDays = all.NumRetentionDays if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_logs_index_list_response.go b/api/datadogV1/model_logs_index_list_response.go index 961b809a4c7..56684eb0356 100644 --- a/api/datadogV1/model_logs_index_list_response.go +++ b/api/datadogV1/model_logs_index_list_response.go @@ -86,8 +86,7 @@ func (o *LogsIndexListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Indexes []LogsIndex `json:"indexes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_index_update_request.go b/api/datadogV1/model_logs_index_update_request.go index 8c352162b05..1f4aa4bf861 100644 --- a/api/datadogV1/model_logs_index_update_request.go +++ b/api/datadogV1/model_logs_index_update_request.go @@ -218,25 +218,14 @@ func (o LogsIndexUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Filter *LogsFilter `json:"filter"` - }{} all := struct { DailyLimit *int64 `json:"daily_limit,omitempty"` DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"` ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"` - Filter LogsFilter `json:"filter"` + Filter *LogsFilter `json:"filter"` NumRetentionDays *int64 `json:"num_retention_days,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Filter == nil { - return fmt.Errorf("required field filter missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -244,6 +233,9 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Filter == nil { + return fmt.Errorf("required field filter missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"daily_limit", "disable_daily_limit", "exclusion_filters", "filter", "num_retention_days"}) @@ -260,7 +252,7 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Filter = all.Filter + o.Filter = *all.Filter o.NumRetentionDays = all.NumRetentionDays if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_logs_indexes_order.go b/api/datadogV1/model_logs_indexes_order.go index 773730f821d..27ff9abaa4c 100644 --- a/api/datadogV1/model_logs_indexes_order.go +++ b/api/datadogV1/model_logs_indexes_order.go @@ -80,21 +80,10 @@ func (o LogsIndexesOrder) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsIndexesOrder) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - IndexNames *[]string `json:"index_names"` - }{} all := struct { - IndexNames []string `json:"index_names"` + IndexNames *[]string `json:"index_names"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IndexNames == nil { - return fmt.Errorf("required field index_names missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -102,13 +91,16 @@ func (o *LogsIndexesOrder) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.IndexNames == nil { + return fmt.Errorf("required field index_names missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"index_names"}) } else { return err } - o.IndexNames = all.IndexNames + o.IndexNames = *all.IndexNames if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_list_request.go b/api/datadogV1/model_logs_list_request.go index 8e063be375d..92c670d6272 100644 --- a/api/datadogV1/model_logs_list_request.go +++ b/api/datadogV1/model_logs_list_request.go @@ -248,26 +248,15 @@ func (o LogsListRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Time *LogsListRequestTime `json:"time"` - }{} all := struct { - Index *string `json:"index,omitempty"` - Limit *int32 `json:"limit,omitempty"` - Query *string `json:"query,omitempty"` - Sort *LogsSort `json:"sort,omitempty"` - StartAt *string `json:"startAt,omitempty"` - Time LogsListRequestTime `json:"time"` + Index *string `json:"index,omitempty"` + Limit *int32 `json:"limit,omitempty"` + Query *string `json:"query,omitempty"` + Sort *LogsSort `json:"sort,omitempty"` + StartAt *string `json:"startAt,omitempty"` + Time *LogsListRequestTime `json:"time"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Time == nil { - return fmt.Errorf("required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -275,6 +264,9 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Time == nil { + return fmt.Errorf("required field time missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"index", "limit", "query", "sort", "startAt", "time"}) @@ -301,7 +293,7 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Time = all.Time + o.Time = *all.Time if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_list_request_time.go b/api/datadogV1/model_logs_list_request_time.go index 4d1fad47cde..fa003b448cc 100644 --- a/api/datadogV1/model_logs_list_request_time.go +++ b/api/datadogV1/model_logs_list_request_time.go @@ -148,27 +148,12 @@ func (o LogsListRequestTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsListRequestTime) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - From *time.Time `json:"from"` - To *time.Time `json:"to"` - }{} all := struct { - From time.Time `json:"from"` - Timezone *string `json:"timezone,omitempty"` - To time.Time `json:"to"` + From *time.Time `json:"from"` + Timezone *string `json:"timezone,omitempty"` + To *time.Time `json:"to"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.From == nil { - return fmt.Errorf("required field from missing") - } - if required.To == nil { - return fmt.Errorf("required field to missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -176,15 +161,21 @@ func (o *LogsListRequestTime) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"from", "timezone", "to"}) } else { return err } - o.From = all.From + o.From = *all.From o.Timezone = all.Timezone - o.To = all.To + o.To = *all.To if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_list_response.go b/api/datadogV1/model_logs_list_response.go index 062bb891f5b..880fb4f0533 100644 --- a/api/datadogV1/model_logs_list_response.go +++ b/api/datadogV1/model_logs_list_response.go @@ -166,8 +166,7 @@ func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { NextLogId datadog.NullableString `json:"nextLogId,omitempty"` Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_lookup_processor.go b/api/datadogV1/model_logs_lookup_processor.go index bb38cf26506..642f1737e1b 100644 --- a/api/datadogV1/model_logs_lookup_processor.go +++ b/api/datadogV1/model_logs_lookup_processor.go @@ -271,46 +271,35 @@ func (o LogsLookupProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - LookupTable *[]string `json:"lookup_table"` - Source *string `json:"source"` - Target *string `json:"target"` - Type *LogsLookupProcessorType `json:"type"` - }{} all := struct { - DefaultLookup *string `json:"default_lookup,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - LookupTable []string `json:"lookup_table"` - Name *string `json:"name,omitempty"` - Source string `json:"source"` - Target string `json:"target"` - Type LogsLookupProcessorType `json:"type"` + DefaultLookup *string `json:"default_lookup,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + LookupTable *[]string `json:"lookup_table"` + Name *string `json:"name,omitempty"` + Source *string `json:"source"` + Target *string `json:"target"` + Type *LogsLookupProcessorType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.LookupTable == nil { + if all.LookupTable == nil { return fmt.Errorf("required field lookup_table missing") } - if required.Source == nil { + if all.Source == nil { return fmt.Errorf("required field source missing") } - if required.Target == nil { + if all.Target == nil { return fmt.Errorf("required field target missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"default_lookup", "is_enabled", "lookup_table", "name", "source", "target", "type"}) @@ -327,11 +316,11 @@ func (o *LogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { } o.DefaultLookup = all.DefaultLookup o.IsEnabled = all.IsEnabled - o.LookupTable = all.LookupTable + o.LookupTable = *all.LookupTable o.Name = all.Name - o.Source = all.Source - o.Target = all.Target - o.Type = all.Type + o.Source = *all.Source + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_message_remapper.go b/api/datadogV1/model_logs_message_remapper.go index 93427200a9e..11d944ea18d 100644 --- a/api/datadogV1/model_logs_message_remapper.go +++ b/api/datadogV1/model_logs_message_remapper.go @@ -182,28 +182,13 @@ func (o LogsMessageRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsMessageRemapperType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsMessageRemapperType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources *[]string `json:"sources"` + Type *LogsMessageRemapperType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -211,6 +196,12 @@ func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "sources", "type"}) @@ -227,8 +218,8 @@ func (o *LogsMessageRemapper) UnmarshalJSON(bytes []byte) (err error) { } o.IsEnabled = all.IsEnabled o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type + o.Sources = *all.Sources + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_pipeline.go b/api/datadogV1/model_logs_pipeline.go index 80d07c5f6f6..08c64ae5af5 100644 --- a/api/datadogV1/model_logs_pipeline.go +++ b/api/datadogV1/model_logs_pipeline.go @@ -280,27 +280,16 @@ func (o LogsPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Filter *LogsFilter `json:"filter,omitempty"` Id *string `json:"id,omitempty"` IsEnabled *bool `json:"is_enabled,omitempty"` IsReadOnly *bool `json:"is_read_only,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Processors []LogsProcessor `json:"processors,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -308,6 +297,9 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"filter", "id", "is_enabled", "is_read_only", "name", "processors", "type"}) @@ -325,7 +317,7 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { o.Id = all.Id o.IsEnabled = all.IsEnabled o.IsReadOnly = all.IsReadOnly - o.Name = all.Name + o.Name = *all.Name o.Processors = all.Processors o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_logs_pipeline_processor.go b/api/datadogV1/model_logs_pipeline_processor.go index 92cb77c6e91..838a46a288f 100644 --- a/api/datadogV1/model_logs_pipeline_processor.go +++ b/api/datadogV1/model_logs_pipeline_processor.go @@ -220,25 +220,14 @@ func (o LogsPipelineProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *LogsPipelineProcessorType `json:"type"` - }{} all := struct { - Filter *LogsFilter `json:"filter,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Processors []LogsProcessor `json:"processors,omitempty"` - Type LogsPipelineProcessorType `json:"type"` + Filter *LogsFilter `json:"filter,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Processors []LogsProcessor `json:"processors,omitempty"` + Type *LogsPipelineProcessorType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -246,6 +235,9 @@ func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"filter", "is_enabled", "name", "processors", "type"}) @@ -271,7 +263,7 @@ func (o *LogsPipelineProcessor) UnmarshalJSON(bytes []byte) (err error) { o.IsEnabled = all.IsEnabled o.Name = all.Name o.Processors = all.Processors - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_pipelines_order.go b/api/datadogV1/model_logs_pipelines_order.go index edb49ff870e..7a433514899 100644 --- a/api/datadogV1/model_logs_pipelines_order.go +++ b/api/datadogV1/model_logs_pipelines_order.go @@ -79,21 +79,10 @@ func (o LogsPipelinesOrder) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipelinesOrder) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - PipelineIds *[]string `json:"pipeline_ids"` - }{} all := struct { - PipelineIds []string `json:"pipeline_ids"` + PipelineIds *[]string `json:"pipeline_ids"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.PipelineIds == nil { - return fmt.Errorf("required field pipeline_ids missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -101,13 +90,16 @@ func (o *LogsPipelinesOrder) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.PipelineIds == nil { + return fmt.Errorf("required field pipeline_ids missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"pipeline_ids"}) } else { return err } - o.PipelineIds = all.PipelineIds + o.PipelineIds = *all.PipelineIds if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_query_compute.go b/api/datadogV1/model_logs_query_compute.go index af9f67f937f..b48d01ee78b 100644 --- a/api/datadogV1/model_logs_query_compute.go +++ b/api/datadogV1/model_logs_query_compute.go @@ -144,23 +144,12 @@ func (o LogsQueryCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsQueryCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *string `json:"aggregation"` - }{} all := struct { - Aggregation string `json:"aggregation"` + Aggregation *string `json:"aggregation"` Facet *string `json:"facet,omitempty"` Interval *int64 `json:"interval,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *LogsQueryCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "facet", "interval"}) } else { return err } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Facet = all.Facet o.Interval = all.Interval if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_logs_retention_agg_sum_usage.go b/api/datadogV1/model_logs_retention_agg_sum_usage.go index 72f398a2bb6..a8b7ec9208d 100644 --- a/api/datadogV1/model_logs_retention_agg_sum_usage.go +++ b/api/datadogV1/model_logs_retention_agg_sum_usage.go @@ -188,8 +188,7 @@ func (o *LogsRetentionAggSumUsage) UnmarshalJSON(bytes []byte) (err error) { LogsRehydratedIndexedLogsUsageAggSum *int64 `json:"logs_rehydrated_indexed_logs_usage_agg_sum,omitempty"` Retention *string `json:"retention,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_retention_sum_usage.go b/api/datadogV1/model_logs_retention_sum_usage.go index b0d449c6bd1..3ba8e03aa56 100644 --- a/api/datadogV1/model_logs_retention_sum_usage.go +++ b/api/datadogV1/model_logs_retention_sum_usage.go @@ -188,8 +188,7 @@ func (o *LogsRetentionSumUsage) UnmarshalJSON(bytes []byte) (err error) { LogsRehydratedIndexedLogsUsageSum *int64 `json:"logs_rehydrated_indexed_logs_usage_sum,omitempty"` Retention *string `json:"retention,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_logs_service_remapper.go b/api/datadogV1/model_logs_service_remapper.go index bebd9fd3171..abd0cba99a6 100644 --- a/api/datadogV1/model_logs_service_remapper.go +++ b/api/datadogV1/model_logs_service_remapper.go @@ -180,28 +180,13 @@ func (o LogsServiceRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsServiceRemapperType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsServiceRemapperType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources *[]string `json:"sources"` + Type *LogsServiceRemapperType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -209,6 +194,12 @@ func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "sources", "type"}) @@ -225,8 +216,8 @@ func (o *LogsServiceRemapper) UnmarshalJSON(bytes []byte) (err error) { } o.IsEnabled = all.IsEnabled o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type + o.Sources = *all.Sources + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_status_remapper.go b/api/datadogV1/model_logs_status_remapper.go index 9ec07ccaa33..a9c1401822d 100644 --- a/api/datadogV1/model_logs_status_remapper.go +++ b/api/datadogV1/model_logs_status_remapper.go @@ -194,28 +194,13 @@ func (o LogsStatusRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Type *LogsStatusRemapperType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Type LogsStatusRemapperType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources *[]string `json:"sources"` + Type *LogsStatusRemapperType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -223,6 +208,12 @@ func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "sources", "type"}) @@ -239,8 +230,8 @@ func (o *LogsStatusRemapper) UnmarshalJSON(bytes []byte) (err error) { } o.IsEnabled = all.IsEnabled o.Name = all.Name - o.Sources = all.Sources - o.Type = all.Type + o.Sources = *all.Sources + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_string_builder_processor.go b/api/datadogV1/model_logs_string_builder_processor.go index 04e3c1353c4..6c2f819c9ee 100644 --- a/api/datadogV1/model_logs_string_builder_processor.go +++ b/api/datadogV1/model_logs_string_builder_processor.go @@ -254,34 +254,15 @@ func (o LogsStringBuilderProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Target *string `json:"target"` - Template *string `json:"template"` - Type *LogsStringBuilderProcessorType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` - Name *string `json:"name,omitempty"` - Target string `json:"target"` - Template string `json:"template"` - Type LogsStringBuilderProcessorType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + IsReplaceMissing *bool `json:"is_replace_missing,omitempty"` + Name *string `json:"name,omitempty"` + Target *string `json:"target"` + Template *string `json:"template"` + Type *LogsStringBuilderProcessorType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Template == nil { - return fmt.Errorf("required field template missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -289,6 +270,15 @@ func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Template == nil { + return fmt.Errorf("required field template missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "is_replace_missing", "name", "target", "template", "type"}) @@ -306,9 +296,9 @@ func (o *LogsStringBuilderProcessor) UnmarshalJSON(bytes []byte) (err error) { o.IsEnabled = all.IsEnabled o.IsReplaceMissing = all.IsReplaceMissing o.Name = all.Name - o.Target = all.Target - o.Template = all.Template - o.Type = all.Type + o.Target = *all.Target + o.Template = *all.Template + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_trace_remapper.go b/api/datadogV1/model_logs_trace_remapper.go index ad40ae199ff..613d95e0398 100644 --- a/api/datadogV1/model_logs_trace_remapper.go +++ b/api/datadogV1/model_logs_trace_remapper.go @@ -188,24 +188,13 @@ func (o LogsTraceRemapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *LogsTraceRemapperType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources,omitempty"` - Type LogsTraceRemapperType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + Name *string `json:"name,omitempty"` + Sources []string `json:"sources,omitempty"` + Type *LogsTraceRemapperType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -213,6 +202,9 @@ func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "sources", "type"}) @@ -230,7 +222,7 @@ func (o *LogsTraceRemapper) UnmarshalJSON(bytes []byte) (err error) { o.IsEnabled = all.IsEnabled o.Name = all.Name o.Sources = all.Sources - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_url_parser.go b/api/datadogV1/model_logs_url_parser.go index cb9d8496503..90e7e55fa6a 100644 --- a/api/datadogV1/model_logs_url_parser.go +++ b/api/datadogV1/model_logs_url_parser.go @@ -254,34 +254,15 @@ func (o LogsURLParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsURLParserType `json:"type"` - }{} all := struct { IsEnabled *bool `json:"is_enabled,omitempty"` Name *string `json:"name,omitempty"` NormalizeEndingSlashes datadog.NullableBool `json:"normalize_ending_slashes,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - Type LogsURLParserType `json:"type"` + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsURLParserType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -289,6 +270,15 @@ func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "name", "normalize_ending_slashes", "sources", "target", "type"}) @@ -306,9 +296,9 @@ func (o *LogsURLParser) UnmarshalJSON(bytes []byte) (err error) { o.IsEnabled = all.IsEnabled o.Name = all.Name o.NormalizeEndingSlashes = all.NormalizeEndingSlashes - o.Sources = all.Sources - o.Target = all.Target - o.Type = all.Type + o.Sources = *all.Sources + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_logs_user_agent_parser.go b/api/datadogV1/model_logs_user_agent_parser.go index ceba0bb9df1..6ce422cb83c 100644 --- a/api/datadogV1/model_logs_user_agent_parser.go +++ b/api/datadogV1/model_logs_user_agent_parser.go @@ -244,34 +244,15 @@ func (o LogsUserAgentParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Sources *[]string `json:"sources"` - Target *string `json:"target"` - Type *LogsUserAgentParserType `json:"type"` - }{} all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - IsEncoded *bool `json:"is_encoded,omitempty"` - Name *string `json:"name,omitempty"` - Sources []string `json:"sources"` - Target string `json:"target"` - Type LogsUserAgentParserType `json:"type"` + IsEnabled *bool `json:"is_enabled,omitempty"` + IsEncoded *bool `json:"is_encoded,omitempty"` + Name *string `json:"name,omitempty"` + Sources *[]string `json:"sources"` + Target *string `json:"target"` + Type *LogsUserAgentParserType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Sources == nil { - return fmt.Errorf("required field sources missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -279,6 +260,15 @@ func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Sources == nil { + return fmt.Errorf("required field sources missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "is_encoded", "name", "sources", "target", "type"}) @@ -296,9 +286,9 @@ func (o *LogsUserAgentParser) UnmarshalJSON(bytes []byte) (err error) { o.IsEnabled = all.IsEnabled o.IsEncoded = all.IsEncoded o.Name = all.Name - o.Sources = all.Sources - o.Target = all.Target - o.Type = all.Type + o.Sources = *all.Sources + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_matching_downtime.go b/api/datadogV1/model_matching_downtime.go index 3d0b2b999a2..504ea9fc1b4 100644 --- a/api/datadogV1/model_matching_downtime.go +++ b/api/datadogV1/model_matching_downtime.go @@ -190,24 +190,13 @@ func (o MatchingDowntime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *int64 `json:"id"` - }{} all := struct { End datadog.NullableInt64 `json:"end,omitempty"` - Id int64 `json:"id"` + Id *int64 `json:"id"` Scope []string `json:"scope,omitempty"` Start *int64 `json:"start,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -215,6 +204,9 @@ func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"end", "id", "scope", "start"}) @@ -222,7 +214,7 @@ func (o *MatchingDowntime) UnmarshalJSON(bytes []byte) (err error) { return err } o.End = all.End - o.Id = all.Id + o.Id = *all.Id o.Scope = all.Scope o.Start = all.Start if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_metric_metadata.go b/api/datadogV1/model_metric_metadata.go index 778aff8e8cb..6f247d36a9c 100644 --- a/api/datadogV1/model_metric_metadata.go +++ b/api/datadogV1/model_metric_metadata.go @@ -290,8 +290,7 @@ func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` Unit *string `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_metric_search_response.go b/api/datadogV1/model_metric_search_response.go index f210d385541..ac5667ac5a3 100644 --- a/api/datadogV1/model_metric_search_response.go +++ b/api/datadogV1/model_metric_search_response.go @@ -86,8 +86,7 @@ func (o *MetricSearchResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Results *MetricSearchResponseResults `json:"results,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_metric_search_response_results.go b/api/datadogV1/model_metric_search_response_results.go index 841edb4be49..9ac93b481af 100644 --- a/api/datadogV1/model_metric_search_response_results.go +++ b/api/datadogV1/model_metric_search_response_results.go @@ -86,8 +86,7 @@ func (o *MetricSearchResponseResults) UnmarshalJSON(bytes []byte) (err error) { all := struct { Metrics []string `json:"metrics,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_metrics_list_response.go b/api/datadogV1/model_metrics_list_response.go index 77f24dfcdcf..d6e5af094d3 100644 --- a/api/datadogV1/model_metrics_list_response.go +++ b/api/datadogV1/model_metrics_list_response.go @@ -120,8 +120,7 @@ func (o *MetricsListResponse) UnmarshalJSON(bytes []byte) (err error) { From *string `json:"from,omitempty"` Metrics []string `json:"metrics,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_metrics_payload.go b/api/datadogV1/model_metrics_payload.go index 500d81c4fdc..528b1e589a8 100644 --- a/api/datadogV1/model_metrics_payload.go +++ b/api/datadogV1/model_metrics_payload.go @@ -78,21 +78,10 @@ func (o MetricsPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsPayload) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Series *[]Series `json:"series"` - }{} all := struct { - Series []Series `json:"series"` + Series *[]Series `json:"series"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Series == nil { - return fmt.Errorf("required field series missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *MetricsPayload) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Series == nil { + return fmt.Errorf("required field series missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"series"}) } else { return err } - o.Series = all.Series + o.Series = *all.Series if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_metrics_query_metadata.go b/api/datadogV1/model_metrics_query_metadata.go index 04944bddf92..ecc5a549eb8 100644 --- a/api/datadogV1/model_metrics_query_metadata.go +++ b/api/datadogV1/model_metrics_query_metadata.go @@ -508,8 +508,7 @@ func (o *MetricsQueryMetadata) UnmarshalJSON(bytes []byte) (err error) { TagSet []string `json:"tag_set,omitempty"` Unit []MetricsQueryUnit `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_metrics_query_response.go b/api/datadogV1/model_metrics_query_response.go index 1f0a2af2e24..a8ae48572f2 100644 --- a/api/datadogV1/model_metrics_query_response.go +++ b/api/datadogV1/model_metrics_query_response.go @@ -358,8 +358,7 @@ func (o *MetricsQueryResponse) UnmarshalJSON(bytes []byte) (err error) { Status *string `json:"status,omitempty"` ToDate *int64 `json:"to_date,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_metrics_query_unit.go b/api/datadogV1/model_metrics_query_unit.go index 8a61afb5483..9fc491a6ed2 100644 --- a/api/datadogV1/model_metrics_query_unit.go +++ b/api/datadogV1/model_metrics_query_unit.go @@ -222,8 +222,7 @@ func (o *MetricsQueryUnit) UnmarshalJSON(bytes []byte) (err error) { ScaleFactor *float64 `json:"scale_factor,omitempty"` ShortName *string `json:"short_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor.go b/api/datadogV1/model_monitor.go index b99fd79eea7..eb1c3dd84b7 100644 --- a/api/datadogV1/model_monitor.go +++ b/api/datadogV1/model_monitor.go @@ -642,10 +642,6 @@ func (o Monitor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *MonitorType `json:"type"` - }{} all := struct { Created *time.Time `json:"created,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -659,24 +655,13 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { Options *MonitorOptions `json:"options,omitempty"` OverallState *MonitorOverallStates `json:"overall_state,omitempty"` Priority datadog.NullableInt64 `json:"priority,omitempty"` - Query string `json:"query"` + Query *string `json:"query"` RestrictedRoles datadog.NullableList[string] `json:"restricted_roles,omitempty"` State *MonitorState `json:"state,omitempty"` Tags []string `json:"tags,omitempty"` - Type MonitorType `json:"type"` + Type *MonitorType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -684,6 +669,12 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"created", "creator", "deleted", "id", "matching_downtimes", "message", "modified", "multi", "name", "options", "overall_state", "priority", "query", "restricted_roles", "state", "tags", "type"}) @@ -732,7 +723,7 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { o.Options = all.Options o.OverallState = all.OverallState o.Priority = all.Priority - o.Query = all.Query + o.Query = *all.Query o.RestrictedRoles = all.RestrictedRoles if all.State != nil && all.State.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -743,7 +734,7 @@ func (o *Monitor) UnmarshalJSON(bytes []byte) (err error) { } o.State = all.State o.Tags = all.Tags - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go b/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go index 5dc23e2b0da..0ed3a75f923 100644 --- a/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go +++ b/api/datadogV1/model_monitor_formula_and_function_event_query_definition.go @@ -231,34 +231,15 @@ func (o MonitorFormulaAndFunctionEventQueryDefinition) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Compute *MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` DataSource *MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` + GroupBy []MonitorFormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` + Indexes []string `json:"indexes,omitempty"` Name *string `json:"name"` + Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` }{} - all := struct { - Compute MonitorFormulaAndFunctionEventQueryDefinitionCompute `json:"compute"` - DataSource MonitorFormulaAndFunctionEventsDataSource `json:"data_source"` - GroupBy []MonitorFormulaAndFunctionEventQueryGroupBy `json:"group_by,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Name string `json:"name"` - Search *MonitorFormulaAndFunctionEventQueryDefinitionSearch `json:"search,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("required field compute missing") - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -266,6 +247,15 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } + if all.Compute == nil { + return fmt.Errorf("required field compute missing") + } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "data_source", "group_by", "indexes", "name", "search"}) @@ -287,11 +277,11 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinition) UnmarshalJSON(bytes []by } o.UnparsedObject = raw } - o.Compute = all.Compute - o.DataSource = all.DataSource + o.Compute = *all.Compute + o.DataSource = *all.DataSource o.GroupBy = all.GroupBy o.Indexes = all.Indexes - o.Name = all.Name + o.Name = *all.Name if all.Search != nil && all.Search.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go b/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go index 3efaf480f1c..8457ccc695d 100644 --- a/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go +++ b/api/datadogV1/model_monitor_formula_and_function_event_query_definition_compute.go @@ -144,23 +144,12 @@ func (o MonitorFormulaAndFunctionEventQueryDefinitionCompute) MarshalJSON() ([]b // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - }{} all := struct { - Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - Interval *int64 `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` + Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + Interval *int64 `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(byt o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "interval", "metric"}) @@ -182,7 +174,7 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinitionCompute) UnmarshalJSON(byt o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go b/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go index bead3032489..4dae16bdeb5 100644 --- a/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go +++ b/api/datadogV1/model_monitor_formula_and_function_event_query_definition_search.go @@ -78,21 +78,10 @@ func (o MonitorFormulaAndFunctionEventQueryDefinitionSearch) MarshalJSON() ([]by // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} all := struct { - Query string `json:"query"` + Query *string `json:"query"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *MonitorFormulaAndFunctionEventQueryDefinitionSearch) UnmarshalJSON(byte o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query"}) } else { return err } - o.Query = all.Query + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go b/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go index b353fabfd41..0d325c45015 100644 --- a/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go +++ b/api/datadogV1/model_monitor_formula_and_function_event_query_group_by.go @@ -144,23 +144,12 @@ func (o MonitorFormulaAndFunctionEventQueryGroupBy) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Limit *int64 `json:"limit,omitempty"` Sort *MonitorFormulaAndFunctionEventQueryGroupBySort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *MonitorFormulaAndFunctionEventQueryGroupBy) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "limit", "sort"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go b/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go index c6123b01155..8e0d12d8ad6 100644 --- a/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go +++ b/api/datadogV1/model_monitor_formula_and_function_event_query_group_by_sort.go @@ -148,23 +148,12 @@ func (o MonitorFormulaAndFunctionEventQueryGroupBySort) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - }{} all := struct { - Aggregation MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` - Metric *string `json:"metric,omitempty"` - Order *QuerySortOrder `json:"order,omitempty"` + Aggregation *MonitorFormulaAndFunctionEventAggregation `json:"aggregation"` + Metric *string `json:"metric,omitempty"` + Order *QuerySortOrder `json:"order,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -172,6 +161,9 @@ func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []b o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "metric", "order"}) @@ -194,7 +186,7 @@ func (o *MonitorFormulaAndFunctionEventQueryGroupBySort) UnmarshalJSON(bytes []b o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Metric = all.Metric o.Order = all.Order if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_monitor_group_search_response.go b/api/datadogV1/model_monitor_group_search_response.go index 52e35ba48fe..112c346cffc 100644 --- a/api/datadogV1/model_monitor_group_search_response.go +++ b/api/datadogV1/model_monitor_group_search_response.go @@ -154,8 +154,7 @@ func (o *MonitorGroupSearchResponse) UnmarshalJSON(bytes []byte) (err error) { Groups []MonitorGroupSearchResult `json:"groups,omitempty"` Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_group_search_response_counts.go b/api/datadogV1/model_monitor_group_search_response_counts.go index 6327110558e..0f6bba97a51 100644 --- a/api/datadogV1/model_monitor_group_search_response_counts.go +++ b/api/datadogV1/model_monitor_group_search_response_counts.go @@ -120,8 +120,7 @@ func (o *MonitorGroupSearchResponseCounts) UnmarshalJSON(bytes []byte) (err erro Status []MonitorSearchCountItem `json:"status,omitempty"` Type []MonitorSearchCountItem `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_group_search_result.go b/api/datadogV1/model_monitor_group_search_result.go index fbd74b5e6ed..0abfe63f264 100644 --- a/api/datadogV1/model_monitor_group_search_result.go +++ b/api/datadogV1/model_monitor_group_search_result.go @@ -301,8 +301,7 @@ func (o *MonitorGroupSearchResult) UnmarshalJSON(bytes []byte) (err error) { MonitorName *string `json:"monitor_name,omitempty"` Status *MonitorOverallStates `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_options.go b/api/datadogV1/model_monitor_options.go index a487ac3eda4..fea7735f1e5 100644 --- a/api/datadogV1/model_monitor_options.go +++ b/api/datadogV1/model_monitor_options.go @@ -1309,8 +1309,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { TimeoutH datadog.NullableInt64 `json:"timeout_h,omitempty"` Variables []MonitorFormulaAndFunctionQueryDefinition `json:"variables,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_options_aggregation.go b/api/datadogV1/model_monitor_options_aggregation.go index f618e20b9ea..11983b4f84e 100644 --- a/api/datadogV1/model_monitor_options_aggregation.go +++ b/api/datadogV1/model_monitor_options_aggregation.go @@ -154,8 +154,7 @@ func (o *MonitorOptionsAggregation) UnmarshalJSON(bytes []byte) (err error) { Metric *string `json:"metric,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_options_scheduling_options.go b/api/datadogV1/model_monitor_options_scheduling_options.go index a666e6663e8..cd444672145 100644 --- a/api/datadogV1/model_monitor_options_scheduling_options.go +++ b/api/datadogV1/model_monitor_options_scheduling_options.go @@ -86,8 +86,7 @@ func (o *MonitorOptionsSchedulingOptions) UnmarshalJSON(bytes []byte) (err error all := struct { EvaluationWindow *MonitorOptionsSchedulingOptionsEvaluationWindow `json:"evaluation_window,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go b/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go index 8fdb6dd9c63..8a6132958de 100644 --- a/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go +++ b/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go @@ -154,8 +154,7 @@ func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) UnmarshalJSON(bytes [] HourStarts *int32 `json:"hour_starts,omitempty"` MonthStarts *int32 `json:"month_starts,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_search_count_item.go b/api/datadogV1/model_monitor_search_count_item.go index 8b3c3aefdc6..45fc1a41b5b 100644 --- a/api/datadogV1/model_monitor_search_count_item.go +++ b/api/datadogV1/model_monitor_search_count_item.go @@ -120,8 +120,7 @@ func (o *MonitorSearchCountItem) UnmarshalJSON(bytes []byte) (err error) { Count *int64 `json:"count,omitempty"` Name interface{} `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_search_response.go b/api/datadogV1/model_monitor_search_response.go index fbab04505ed..77462f3c838 100644 --- a/api/datadogV1/model_monitor_search_response.go +++ b/api/datadogV1/model_monitor_search_response.go @@ -154,8 +154,7 @@ func (o *MonitorSearchResponse) UnmarshalJSON(bytes []byte) (err error) { Metadata *MonitorSearchResponseMetadata `json:"metadata,omitempty"` Monitors []MonitorSearchResult `json:"monitors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_search_response_counts.go b/api/datadogV1/model_monitor_search_response_counts.go index 20ced576102..327250e1bb7 100644 --- a/api/datadogV1/model_monitor_search_response_counts.go +++ b/api/datadogV1/model_monitor_search_response_counts.go @@ -188,8 +188,7 @@ func (o *MonitorSearchResponseCounts) UnmarshalJSON(bytes []byte) (err error) { Tag []MonitorSearchCountItem `json:"tag,omitempty"` Type []MonitorSearchCountItem `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_search_response_metadata.go b/api/datadogV1/model_monitor_search_response_metadata.go index b73434ddee9..6a6d0c84f9e 100644 --- a/api/datadogV1/model_monitor_search_response_metadata.go +++ b/api/datadogV1/model_monitor_search_response_metadata.go @@ -188,8 +188,7 @@ func (o *MonitorSearchResponseMetadata) UnmarshalJSON(bytes []byte) (err error) PerPage *int64 `json:"per_page,omitempty"` TotalCount *int64 `json:"total_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_search_result.go b/api/datadogV1/model_monitor_search_result.go index 6e591a79059..90f9af3f4f0 100644 --- a/api/datadogV1/model_monitor_search_result.go +++ b/api/datadogV1/model_monitor_search_result.go @@ -508,8 +508,7 @@ func (o *MonitorSearchResult) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Type *MonitorType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_search_result_notification.go b/api/datadogV1/model_monitor_search_result_notification.go index b8cec33675a..c1083738130 100644 --- a/api/datadogV1/model_monitor_search_result_notification.go +++ b/api/datadogV1/model_monitor_search_result_notification.go @@ -120,8 +120,7 @@ func (o *MonitorSearchResultNotification) UnmarshalJSON(bytes []byte) (err error Handle *string `json:"handle,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_state.go b/api/datadogV1/model_monitor_state.go index a3606b24685..194e0f0e824 100644 --- a/api/datadogV1/model_monitor_state.go +++ b/api/datadogV1/model_monitor_state.go @@ -87,8 +87,7 @@ func (o *MonitorState) UnmarshalJSON(bytes []byte) (err error) { all := struct { Groups map[string]MonitorStateGroup `json:"groups,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_state_group.go b/api/datadogV1/model_monitor_state_group.go index aab4725b31f..78e7446e6b6 100644 --- a/api/datadogV1/model_monitor_state_group.go +++ b/api/datadogV1/model_monitor_state_group.go @@ -256,8 +256,7 @@ func (o *MonitorStateGroup) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Status *MonitorOverallStates `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_summary_widget_definition.go b/api/datadogV1/model_monitor_summary_widget_definition.go index baa66404495..888158ffc33 100644 --- a/api/datadogV1/model_monitor_summary_widget_definition.go +++ b/api/datadogV1/model_monitor_summary_widget_definition.go @@ -515,38 +515,23 @@ func (o MonitorSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - Type *MonitorSummaryWidgetDefinitionType `json:"type"` - }{} all := struct { - ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` - Count *int64 `json:"count,omitempty"` - DisplayFormat *WidgetMonitorSummaryDisplayFormat `json:"display_format,omitempty"` - HideZeroCounts *bool `json:"hide_zero_counts,omitempty"` - Query string `json:"query"` - ShowLastTriggered *bool `json:"show_last_triggered,omitempty"` - ShowPriority *bool `json:"show_priority,omitempty"` - Sort *WidgetMonitorSummarySort `json:"sort,omitempty"` - Start *int64 `json:"start,omitempty"` - SummaryType *WidgetSummaryType `json:"summary_type,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type MonitorSummaryWidgetDefinitionType `json:"type"` + ColorPreference *WidgetColorPreference `json:"color_preference,omitempty"` + Count *int64 `json:"count,omitempty"` + DisplayFormat *WidgetMonitorSummaryDisplayFormat `json:"display_format,omitempty"` + HideZeroCounts *bool `json:"hide_zero_counts,omitempty"` + Query *string `json:"query"` + ShowLastTriggered *bool `json:"show_last_triggered,omitempty"` + ShowPriority *bool `json:"show_priority,omitempty"` + Sort *WidgetMonitorSummarySort `json:"sort,omitempty"` + Start *int64 `json:"start,omitempty"` + SummaryType *WidgetSummaryType `json:"summary_type,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *MonitorSummaryWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -554,6 +539,12 @@ func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"color_preference", "count", "display_format", "hide_zero_counts", "query", "show_last_triggered", "show_priority", "sort", "start", "summary_type", "title", "title_align", "title_size", "type"}) @@ -612,7 +603,7 @@ func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.Count = all.Count o.DisplayFormat = all.DisplayFormat o.HideZeroCounts = all.HideZeroCounts - o.Query = all.Query + o.Query = *all.Query o.ShowLastTriggered = all.ShowLastTriggered o.ShowPriority = all.ShowPriority o.Sort = all.Sort @@ -621,7 +612,7 @@ func (o *MonitorSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_monitor_threshold_window_options.go b/api/datadogV1/model_monitor_threshold_window_options.go index fecf9aa0711..6bce415124f 100644 --- a/api/datadogV1/model_monitor_threshold_window_options.go +++ b/api/datadogV1/model_monitor_threshold_window_options.go @@ -142,8 +142,7 @@ func (o *MonitorThresholdWindowOptions) UnmarshalJSON(bytes []byte) (err error) RecoveryWindow datadog.NullableString `json:"recovery_window,omitempty"` TriggerWindow datadog.NullableString `json:"trigger_window,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_thresholds.go b/api/datadogV1/model_monitor_thresholds.go index dd79ca9280a..09c75db55c6 100644 --- a/api/datadogV1/model_monitor_thresholds.go +++ b/api/datadogV1/model_monitor_thresholds.go @@ -311,8 +311,7 @@ func (o *MonitorThresholds) UnmarshalJSON(bytes []byte) (err error) { Warning datadog.NullableFloat64 `json:"warning,omitempty"` WarningRecovery datadog.NullableFloat64 `json:"warning_recovery,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monitor_update_request.go b/api/datadogV1/model_monitor_update_request.go index c1e0362d114..c32df187f84 100644 --- a/api/datadogV1/model_monitor_update_request.go +++ b/api/datadogV1/model_monitor_update_request.go @@ -627,8 +627,7 @@ func (o *MonitorUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Type *MonitorType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monthly_usage_attribution_body.go b/api/datadogV1/model_monthly_usage_attribution_body.go index ade642c1521..8ad1c5f20f1 100644 --- a/api/datadogV1/model_monthly_usage_attribution_body.go +++ b/api/datadogV1/model_monthly_usage_attribution_body.go @@ -338,8 +338,7 @@ func (o *MonthlyUsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { UpdatedAt *time.Time `json:"updated_at,omitempty"` Values *MonthlyUsageAttributionValues `json:"values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monthly_usage_attribution_metadata.go b/api/datadogV1/model_monthly_usage_attribution_metadata.go index 06570c6f701..26ff75915d6 100644 --- a/api/datadogV1/model_monthly_usage_attribution_metadata.go +++ b/api/datadogV1/model_monthly_usage_attribution_metadata.go @@ -120,8 +120,7 @@ func (o *MonthlyUsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` Pagination *MonthlyUsageAttributionPagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monthly_usage_attribution_pagination.go b/api/datadogV1/model_monthly_usage_attribution_pagination.go index 11fa5e813a6..892cd034401 100644 --- a/api/datadogV1/model_monthly_usage_attribution_pagination.go +++ b/api/datadogV1/model_monthly_usage_attribution_pagination.go @@ -97,8 +97,7 @@ func (o *MonthlyUsageAttributionPagination) UnmarshalJSON(bytes []byte) (err err all := struct { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monthly_usage_attribution_response.go b/api/datadogV1/model_monthly_usage_attribution_response.go index 1b6f75af2d1..84fe5d08a1e 100644 --- a/api/datadogV1/model_monthly_usage_attribution_response.go +++ b/api/datadogV1/model_monthly_usage_attribution_response.go @@ -120,8 +120,7 @@ func (o *MonthlyUsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error Metadata *MonthlyUsageAttributionMetadata `json:"metadata,omitempty"` Usage []MonthlyUsageAttributionBody `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_monthly_usage_attribution_values.go b/api/datadogV1/model_monthly_usage_attribution_values.go index 25b44d1c1d0..d63b9cce805 100644 --- a/api/datadogV1/model_monthly_usage_attribution_values.go +++ b/api/datadogV1/model_monthly_usage_attribution_values.go @@ -2296,8 +2296,7 @@ func (o *MonthlyUsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) VulnManagementHostsPercentage *float64 `json:"vuln_management_hosts_percentage,omitempty"` VulnManagementHostsUsage *float64 `json:"vuln_management_hosts_usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_note_widget_definition.go b/api/datadogV1/model_note_widget_definition.go index 88866987511..90b96e53553 100644 --- a/api/datadogV1/model_note_widget_definition.go +++ b/api/datadogV1/model_note_widget_definition.go @@ -375,34 +375,19 @@ func (o NoteWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Content *string `json:"content"` - Type *NoteWidgetDefinitionType `json:"type"` - }{} all := struct { - BackgroundColor *string `json:"background_color,omitempty"` - Content string `json:"content"` - FontSize *string `json:"font_size,omitempty"` - HasPadding *bool `json:"has_padding,omitempty"` - ShowTick *bool `json:"show_tick,omitempty"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - TickEdge *WidgetTickEdge `json:"tick_edge,omitempty"` - TickPos *string `json:"tick_pos,omitempty"` - Type NoteWidgetDefinitionType `json:"type"` - VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` + BackgroundColor *string `json:"background_color,omitempty"` + Content *string `json:"content"` + FontSize *string `json:"font_size,omitempty"` + HasPadding *bool `json:"has_padding,omitempty"` + ShowTick *bool `json:"show_tick,omitempty"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + TickEdge *WidgetTickEdge `json:"tick_edge,omitempty"` + TickPos *string `json:"tick_pos,omitempty"` + Type *NoteWidgetDefinitionType `json:"type"` + VerticalAlign *WidgetVerticalAlign `json:"vertical_align,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Content == nil { - return fmt.Errorf("required field content missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -410,6 +395,12 @@ func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Content == nil { + return fmt.Errorf("required field content missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"background_color", "content", "font_size", "has_padding", "show_tick", "text_align", "tick_edge", "tick_pos", "type", "vertical_align"}) @@ -449,14 +440,14 @@ func (o *NoteWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.BackgroundColor = all.BackgroundColor - o.Content = all.Content + o.Content = *all.Content o.FontSize = all.FontSize o.HasPadding = all.HasPadding o.ShowTick = all.ShowTick o.TextAlign = all.TextAlign o.TickEdge = all.TickEdge o.TickPos = all.TickPos - o.Type = all.Type + o.Type = *all.Type o.VerticalAlign = all.VerticalAlign if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_notebook_absolute_time.go b/api/datadogV1/model_notebook_absolute_time.go index cefe3c4c273..832407bd22f 100644 --- a/api/datadogV1/model_notebook_absolute_time.go +++ b/api/datadogV1/model_notebook_absolute_time.go @@ -147,27 +147,12 @@ func (o NotebookAbsoluteTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookAbsoluteTime) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { End *time.Time `json:"end"` + Live *bool `json:"live,omitempty"` Start *time.Time `json:"start"` }{} - all := struct { - End time.Time `json:"end"` - Live *bool `json:"live,omitempty"` - Start time.Time `json:"start"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -175,15 +160,21 @@ func (o *NotebookAbsoluteTime) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.End == nil { + return fmt.Errorf("required field end missing") + } + if all.Start == nil { + return fmt.Errorf("required field start missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"end", "live", "start"}) } else { return err } - o.End = all.End + o.End = *all.End o.Live = all.Live - o.Start = all.Start + o.Start = *all.Start if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_author.go b/api/datadogV1/model_notebook_author.go index 998682b2f23..e901a9bd31f 100644 --- a/api/datadogV1/model_notebook_author.go +++ b/api/datadogV1/model_notebook_author.go @@ -385,8 +385,7 @@ func (o *NotebookAuthor) UnmarshalJSON(bytes []byte) (err error) { Title datadog.NullableString `json:"title,omitempty"` Verified *bool `json:"verified,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_notebook_cell_create_request.go b/api/datadogV1/model_notebook_cell_create_request.go index bb18ba48300..2c2f6067500 100644 --- a/api/datadogV1/model_notebook_cell_create_request.go +++ b/api/datadogV1/model_notebook_cell_create_request.go @@ -101,26 +101,11 @@ func (o NotebookCellCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebookCellCreateRequestAttributes `json:"attributes"` Type *NotebookCellResourceType `json:"type"` }{} - all := struct { - Attributes NotebookCellCreateRequestAttributes `json:"attributes"` - Type NotebookCellResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -128,6 +113,12 @@ func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } if v := all.Type; !v.IsValid() { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -136,8 +127,8 @@ func (o *NotebookCellCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type return nil } diff --git a/api/datadogV1/model_notebook_cell_response.go b/api/datadogV1/model_notebook_cell_response.go index 1a6aff3f678..13a6877deb6 100644 --- a/api/datadogV1/model_notebook_cell_response.go +++ b/api/datadogV1/model_notebook_cell_response.go @@ -135,31 +135,12 @@ func (o NotebookCellResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebookCellResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *NotebookCellResourceType `json:"type"` }{} - all := struct { - Attributes NotebookCellResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type NotebookCellResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -167,6 +148,15 @@ func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -181,9 +171,9 @@ func (o *NotebookCellResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_cell_update_request.go b/api/datadogV1/model_notebook_cell_update_request.go index 6f1cbf3b683..0a8505dd843 100644 --- a/api/datadogV1/model_notebook_cell_update_request.go +++ b/api/datadogV1/model_notebook_cell_update_request.go @@ -135,31 +135,12 @@ func (o NotebookCellUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebookCellUpdateRequestAttributes `json:"attributes"` Id *string `json:"id"` Type *NotebookCellResourceType `json:"type"` }{} - all := struct { - Attributes NotebookCellUpdateRequestAttributes `json:"attributes"` - Id string `json:"id"` - Type NotebookCellResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -167,6 +148,15 @@ func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -181,9 +171,9 @@ func (o *NotebookCellUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_create_data.go b/api/datadogV1/model_notebook_create_data.go index 53ed76b9f88..3fc91a8c7b4 100644 --- a/api/datadogV1/model_notebook_create_data.go +++ b/api/datadogV1/model_notebook_create_data.go @@ -107,26 +107,11 @@ func (o NotebookCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebookCreateDataAttributes `json:"attributes"` Type *NotebookResourceType `json:"type"` }{} - all := struct { - Attributes NotebookCreateDataAttributes `json:"attributes"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_create_data_attributes.go b/api/datadogV1/model_notebook_create_data_attributes.go index 32b39bea733..cb92a2fb491 100644 --- a/api/datadogV1/model_notebook_create_data_attributes.go +++ b/api/datadogV1/model_notebook_create_data_attributes.go @@ -202,33 +202,14 @@ func (o NotebookCreateDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Cells *[]NotebookCellCreateRequest `json:"cells"` - Name *string `json:"name"` - Time *NotebookGlobalTime `json:"time"` - }{} all := struct { - Cells []NotebookCellCreateRequest `json:"cells"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time NotebookGlobalTime `json:"time"` + Cells *[]NotebookCellCreateRequest `json:"cells"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Name *string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time *NotebookGlobalTime `json:"time"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cells == nil { - return fmt.Errorf("required field cells missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Time == nil { - return fmt.Errorf("required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -236,6 +217,15 @@ func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Cells == nil { + return fmt.Errorf("required field cells missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Time == nil { + return fmt.Errorf("required field time missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"cells", "metadata", "name", "status", "time"}) @@ -250,7 +240,7 @@ func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Cells = all.Cells + o.Cells = *all.Cells if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -259,9 +249,9 @@ func (o *NotebookCreateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.Name = all.Name + o.Name = *all.Name o.Status = all.Status - o.Time = all.Time + o.Time = *all.Time if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_create_request.go b/api/datadogV1/model_notebook_create_request.go index 99d9c86bac2..be6da096e30 100644 --- a/api/datadogV1/model_notebook_create_request.go +++ b/api/datadogV1/model_notebook_create_request.go @@ -78,21 +78,10 @@ func (o NotebookCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *NotebookCreateData `json:"data"` - }{} all := struct { - Data NotebookCreateData `json:"data"` + Data *NotebookCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_distribution_cell_attributes.go b/api/datadogV1/model_notebook_distribution_cell_attributes.go index 4fc16b4249f..1e61e60f18c 100644 --- a/api/datadogV1/model_notebook_distribution_cell_attributes.go +++ b/api/datadogV1/model_notebook_distribution_cell_attributes.go @@ -190,24 +190,13 @@ func (o NotebookDistributionCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *DistributionWidgetDefinition `json:"definition"` - }{} all := struct { - Definition DistributionWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` + Definition *DistributionWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -215,6 +204,9 @@ func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition", "graph_size", "split_by", "time"}) @@ -236,7 +228,7 @@ func (o *NotebookDistributionCellAttributes) UnmarshalJSON(bytes []byte) (err er } o.UnparsedObject = raw } - o.Definition = all.Definition + o.Definition = *all.Definition o.GraphSize = all.GraphSize if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_notebook_heat_map_cell_attributes.go b/api/datadogV1/model_notebook_heat_map_cell_attributes.go index ebf0f493f64..efa31cac675 100644 --- a/api/datadogV1/model_notebook_heat_map_cell_attributes.go +++ b/api/datadogV1/model_notebook_heat_map_cell_attributes.go @@ -188,24 +188,13 @@ func (o NotebookHeatMapCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *HeatMapWidgetDefinition `json:"definition"` - }{} all := struct { - Definition HeatMapWidgetDefinition `json:"definition"` + Definition *HeatMapWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` SplitBy *NotebookSplitBy `json:"split_by,omitempty"` Time NullableNotebookCellTime `json:"time,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -213,6 +202,9 @@ func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition", "graph_size", "split_by", "time"}) @@ -234,7 +226,7 @@ func (o *NotebookHeatMapCellAttributes) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Definition = all.Definition + o.Definition = *all.Definition o.GraphSize = all.GraphSize if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_notebook_log_stream_cell_attributes.go b/api/datadogV1/model_notebook_log_stream_cell_attributes.go index e5d41e65b5c..f9fa0a0d95e 100644 --- a/api/datadogV1/model_notebook_log_stream_cell_attributes.go +++ b/api/datadogV1/model_notebook_log_stream_cell_attributes.go @@ -155,23 +155,12 @@ func (o NotebookLogStreamCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *LogStreamWidgetDefinition `json:"definition"` - }{} all := struct { - Definition LogStreamWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` + Definition *LogStreamWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -179,6 +168,9 @@ func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition", "graph_size", "time"}) @@ -200,7 +192,7 @@ func (o *NotebookLogStreamCellAttributes) UnmarshalJSON(bytes []byte) (err error } o.UnparsedObject = raw } - o.Definition = all.Definition + o.Definition = *all.Definition o.GraphSize = all.GraphSize o.Time = all.Time if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_notebook_markdown_cell_attributes.go b/api/datadogV1/model_notebook_markdown_cell_attributes.go index 3478495c860..edfe28471d5 100644 --- a/api/datadogV1/model_notebook_markdown_cell_attributes.go +++ b/api/datadogV1/model_notebook_markdown_cell_attributes.go @@ -78,21 +78,10 @@ func (o NotebookMarkdownCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *NotebookMarkdownCellDefinition `json:"definition"` - }{} all := struct { - Definition NotebookMarkdownCellDefinition `json:"definition"` + Definition *NotebookMarkdownCellDefinition `json:"definition"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition"}) @@ -113,7 +105,7 @@ func (o *NotebookMarkdownCellAttributes) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Definition = all.Definition + o.Definition = *all.Definition if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_markdown_cell_definition.go b/api/datadogV1/model_notebook_markdown_cell_definition.go index 176008ee9f7..d9ffefa1459 100644 --- a/api/datadogV1/model_notebook_markdown_cell_definition.go +++ b/api/datadogV1/model_notebook_markdown_cell_definition.go @@ -107,26 +107,11 @@ func (o NotebookMarkdownCellDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Text *string `json:"text"` Type *NotebookMarkdownCellDefinitionType `json:"type"` }{} - all := struct { - Text string `json:"text"` - Type NotebookMarkdownCellDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Text == nil { - return fmt.Errorf("required field text missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Text == nil { + return fmt.Errorf("required field text missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"text", "type"}) @@ -148,8 +139,8 @@ func (o *NotebookMarkdownCellDefinition) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Text = all.Text - o.Type = all.Type + o.Text = *all.Text + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_metadata.go b/api/datadogV1/model_notebook_metadata.go index 591fdf89fa8..3805a438c3c 100644 --- a/api/datadogV1/model_notebook_metadata.go +++ b/api/datadogV1/model_notebook_metadata.go @@ -173,8 +173,7 @@ func (o *NotebookMetadata) UnmarshalJSON(bytes []byte) (err error) { TakeSnapshots *bool `json:"take_snapshots,omitempty"` Type NullableNotebookMetadataType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_notebook_relative_time.go b/api/datadogV1/model_notebook_relative_time.go index c8acf718204..4bca43c634f 100644 --- a/api/datadogV1/model_notebook_relative_time.go +++ b/api/datadogV1/model_notebook_relative_time.go @@ -78,21 +78,10 @@ func (o NotebookRelativeTime) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - LiveSpan *WidgetLiveSpan `json:"live_span"` - }{} all := struct { - LiveSpan WidgetLiveSpan `json:"live_span"` + LiveSpan *WidgetLiveSpan `json:"live_span"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.LiveSpan == nil { - return fmt.Errorf("required field live_span missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.LiveSpan == nil { + return fmt.Errorf("required field live_span missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"live_span"}) @@ -114,7 +106,7 @@ func (o *NotebookRelativeTime) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.LiveSpan = all.LiveSpan + o.LiveSpan = *all.LiveSpan if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_response.go b/api/datadogV1/model_notebook_response.go index f22b21a67b2..f7c2f732c8b 100644 --- a/api/datadogV1/model_notebook_response.go +++ b/api/datadogV1/model_notebook_response.go @@ -86,8 +86,7 @@ func (o *NotebookResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *NotebookResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_notebook_response_data.go b/api/datadogV1/model_notebook_response_data.go index 1514b69bf19..2ab8bb398c2 100644 --- a/api/datadogV1/model_notebook_response_data.go +++ b/api/datadogV1/model_notebook_response_data.go @@ -134,31 +134,12 @@ func (o NotebookResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebookResponseDataAttributes `json:"attributes"` Id *int64 `json:"id"` Type *NotebookResourceType `json:"type"` }{} - all := struct { - Attributes NotebookResponseDataAttributes `json:"attributes"` - Id int64 `json:"id"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *NotebookResponseData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_response_data_attributes.go b/api/datadogV1/model_notebook_response_data_attributes.go index bfb0339778e..c2dc5470464 100644 --- a/api/datadogV1/model_notebook_response_data_attributes.go +++ b/api/datadogV1/model_notebook_response_data_attributes.go @@ -310,36 +310,17 @@ func (o NotebookResponseDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Cells *[]NotebookCellResponse `json:"cells"` - Name *string `json:"name"` - Time *NotebookGlobalTime `json:"time"` - }{} all := struct { - Author *NotebookAuthor `json:"author,omitempty"` - Cells []NotebookCellResponse `json:"cells"` - Created *time.Time `json:"created,omitempty"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Modified *time.Time `json:"modified,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time NotebookGlobalTime `json:"time"` + Author *NotebookAuthor `json:"author,omitempty"` + Cells *[]NotebookCellResponse `json:"cells"` + Created *time.Time `json:"created,omitempty"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + Name *string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time *NotebookGlobalTime `json:"time"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cells == nil { - return fmt.Errorf("required field cells missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Time == nil { - return fmt.Errorf("required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -347,6 +328,15 @@ func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Cells == nil { + return fmt.Errorf("required field cells missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Time == nil { + return fmt.Errorf("required field time missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author", "cells", "created", "metadata", "modified", "name", "status", "time"}) @@ -369,7 +359,7 @@ func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw } o.Author = all.Author - o.Cells = all.Cells + o.Cells = *all.Cells o.Created = all.Created if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -380,9 +370,9 @@ func (o *NotebookResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) } o.Metadata = all.Metadata o.Modified = all.Modified - o.Name = all.Name + o.Name = *all.Name o.Status = all.Status - o.Time = all.Time + o.Time = *all.Time if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_split_by.go b/api/datadogV1/model_notebook_split_by.go index a889c7cc959..11cb3874957 100644 --- a/api/datadogV1/model_notebook_split_by.go +++ b/api/datadogV1/model_notebook_split_by.go @@ -105,26 +105,11 @@ func (o NotebookSplitBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookSplitBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Keys *[]string `json:"keys"` Tags *[]string `json:"tags"` }{} - all := struct { - Keys []string `json:"keys"` - Tags []string `json:"tags"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Keys == nil { - return fmt.Errorf("required field keys missing") - } - if required.Tags == nil { - return fmt.Errorf("required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *NotebookSplitBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Keys == nil { + return fmt.Errorf("required field keys missing") + } + if all.Tags == nil { + return fmt.Errorf("required field tags missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"keys", "tags"}) } else { return err } - o.Keys = all.Keys - o.Tags = all.Tags + o.Keys = *all.Keys + o.Tags = *all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_timeseries_cell_attributes.go b/api/datadogV1/model_notebook_timeseries_cell_attributes.go index 4a03a8d65cd..8f5ce4d5ccd 100644 --- a/api/datadogV1/model_notebook_timeseries_cell_attributes.go +++ b/api/datadogV1/model_notebook_timeseries_cell_attributes.go @@ -188,24 +188,13 @@ func (o NotebookTimeseriesCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *TimeseriesWidgetDefinition `json:"definition"` - }{} all := struct { - Definition TimeseriesWidgetDefinition `json:"definition"` - GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` - SplitBy *NotebookSplitBy `json:"split_by,omitempty"` - Time NullableNotebookCellTime `json:"time,omitempty"` + Definition *TimeseriesWidgetDefinition `json:"definition"` + GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` + SplitBy *NotebookSplitBy `json:"split_by,omitempty"` + Time NullableNotebookCellTime `json:"time,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -213,6 +202,9 @@ func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition", "graph_size", "split_by", "time"}) @@ -234,7 +226,7 @@ func (o *NotebookTimeseriesCellAttributes) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Definition = all.Definition + o.Definition = *all.Definition o.GraphSize = all.GraphSize if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_notebook_toplist_cell_attributes.go b/api/datadogV1/model_notebook_toplist_cell_attributes.go index 276a7932fb4..96de9adbeca 100644 --- a/api/datadogV1/model_notebook_toplist_cell_attributes.go +++ b/api/datadogV1/model_notebook_toplist_cell_attributes.go @@ -188,24 +188,13 @@ func (o NotebookToplistCellAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *ToplistWidgetDefinition `json:"definition"` - }{} all := struct { - Definition ToplistWidgetDefinition `json:"definition"` + Definition *ToplistWidgetDefinition `json:"definition"` GraphSize *NotebookGraphSize `json:"graph_size,omitempty"` SplitBy *NotebookSplitBy `json:"split_by,omitempty"` Time NullableNotebookCellTime `json:"time,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -213,6 +202,9 @@ func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition", "graph_size", "split_by", "time"}) @@ -234,7 +226,7 @@ func (o *NotebookToplistCellAttributes) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Definition = all.Definition + o.Definition = *all.Definition o.GraphSize = all.GraphSize if all.SplitBy != nil && all.SplitBy.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_notebook_update_data.go b/api/datadogV1/model_notebook_update_data.go index cf5237ad91b..29ae09ced29 100644 --- a/api/datadogV1/model_notebook_update_data.go +++ b/api/datadogV1/model_notebook_update_data.go @@ -107,26 +107,11 @@ func (o NotebookUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebookUpdateDataAttributes `json:"attributes"` Type *NotebookResourceType `json:"type"` }{} - all := struct { - Attributes NotebookUpdateDataAttributes `json:"attributes"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *NotebookUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_update_data_attributes.go b/api/datadogV1/model_notebook_update_data_attributes.go index dd4b3cff31e..885b1f93526 100644 --- a/api/datadogV1/model_notebook_update_data_attributes.go +++ b/api/datadogV1/model_notebook_update_data_attributes.go @@ -202,33 +202,14 @@ func (o NotebookUpdateDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Cells *[]NotebookUpdateCell `json:"cells"` - Name *string `json:"name"` - Time *NotebookGlobalTime `json:"time"` - }{} all := struct { - Cells []NotebookUpdateCell `json:"cells"` - Metadata *NotebookMetadata `json:"metadata,omitempty"` - Name string `json:"name"` - Status *NotebookStatus `json:"status,omitempty"` - Time NotebookGlobalTime `json:"time"` + Cells *[]NotebookUpdateCell `json:"cells"` + Metadata *NotebookMetadata `json:"metadata,omitempty"` + Name *string `json:"name"` + Status *NotebookStatus `json:"status,omitempty"` + Time *NotebookGlobalTime `json:"time"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Cells == nil { - return fmt.Errorf("required field cells missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Time == nil { - return fmt.Errorf("required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -236,6 +217,15 @@ func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Cells == nil { + return fmt.Errorf("required field cells missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Time == nil { + return fmt.Errorf("required field time missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"cells", "metadata", "name", "status", "time"}) @@ -250,7 +240,7 @@ func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Cells = all.Cells + o.Cells = *all.Cells if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -259,9 +249,9 @@ func (o *NotebookUpdateDataAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.Name = all.Name + o.Name = *all.Name o.Status = all.Status - o.Time = all.Time + o.Time = *all.Time if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebook_update_request.go b/api/datadogV1/model_notebook_update_request.go index e7759ca648a..7d0e1216cde 100644 --- a/api/datadogV1/model_notebook_update_request.go +++ b/api/datadogV1/model_notebook_update_request.go @@ -78,21 +78,10 @@ func (o NotebookUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *NotebookUpdateData `json:"data"` - }{} all := struct { - Data NotebookUpdateData `json:"data"` + Data *NotebookUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *NotebookUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebooks_response.go b/api/datadogV1/model_notebooks_response.go index 05cce5ca9be..5452fce394f 100644 --- a/api/datadogV1/model_notebooks_response.go +++ b/api/datadogV1/model_notebooks_response.go @@ -120,8 +120,7 @@ func (o *NotebooksResponse) UnmarshalJSON(bytes []byte) (err error) { Data []NotebooksResponseData `json:"data,omitempty"` Meta *NotebooksResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_notebooks_response_data.go b/api/datadogV1/model_notebooks_response_data.go index de356d69488..f77ad006adf 100644 --- a/api/datadogV1/model_notebooks_response_data.go +++ b/api/datadogV1/model_notebooks_response_data.go @@ -134,31 +134,12 @@ func (o NotebooksResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *NotebooksResponseDataAttributes `json:"attributes"` Id *int64 `json:"id"` Type *NotebookResourceType `json:"type"` }{} - all := struct { - Attributes NotebooksResponseDataAttributes `json:"attributes"` - Id int64 `json:"id"` - Type NotebookResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *NotebooksResponseData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_notebooks_response_data_attributes.go b/api/datadogV1/model_notebooks_response_data_attributes.go index 3de812490d7..901f9483e36 100644 --- a/api/datadogV1/model_notebooks_response_data_attributes.go +++ b/api/datadogV1/model_notebooks_response_data_attributes.go @@ -322,28 +322,17 @@ func (o NotebooksResponseDataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Author *NotebookAuthor `json:"author,omitempty"` Cells []NotebookCellResponse `json:"cells,omitempty"` Created *time.Time `json:"created,omitempty"` Metadata *NotebookMetadata `json:"metadata,omitempty"` Modified *time.Time `json:"modified,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Status *NotebookStatus `json:"status,omitempty"` Time *NotebookGlobalTime `json:"time,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -351,6 +340,9 @@ func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author", "cells", "created", "metadata", "modified", "name", "status", "time"}) @@ -384,7 +376,7 @@ func (o *NotebooksResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error } o.Metadata = all.Metadata o.Modified = all.Modified - o.Name = all.Name + o.Name = *all.Name o.Status = all.Status o.Time = all.Time if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_notebooks_response_meta.go b/api/datadogV1/model_notebooks_response_meta.go index a5afdb43221..f73806ce366 100644 --- a/api/datadogV1/model_notebooks_response_meta.go +++ b/api/datadogV1/model_notebooks_response_meta.go @@ -86,8 +86,7 @@ func (o *NotebooksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *NotebooksResponsePage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_notebooks_response_page.go b/api/datadogV1/model_notebooks_response_page.go index c030c6918a4..42658783f8f 100644 --- a/api/datadogV1/model_notebooks_response_page.go +++ b/api/datadogV1/model_notebooks_response_page.go @@ -120,8 +120,7 @@ func (o *NotebooksResponsePage) UnmarshalJSON(bytes []byte) (err error) { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_org_downgraded_response.go b/api/datadogV1/model_org_downgraded_response.go index 2625d008ffc..959e82f5b78 100644 --- a/api/datadogV1/model_org_downgraded_response.go +++ b/api/datadogV1/model_org_downgraded_response.go @@ -86,8 +86,7 @@ func (o *OrgDowngradedResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization.go b/api/datadogV1/model_organization.go index f6f5fb29c76..afec8416e60 100644 --- a/api/datadogV1/model_organization.go +++ b/api/datadogV1/model_organization.go @@ -332,8 +332,7 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { Subscription *OrganizationSubscription `json:"subscription,omitempty"` Trial *bool `json:"trial,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_billing.go b/api/datadogV1/model_organization_billing.go index 8f682739c0b..173ae9b041b 100644 --- a/api/datadogV1/model_organization_billing.go +++ b/api/datadogV1/model_organization_billing.go @@ -88,8 +88,7 @@ func (o *OrganizationBilling) UnmarshalJSON(bytes []byte) (err error) { all := struct { Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_create_body.go b/api/datadogV1/model_organization_create_body.go index fcbf3f446cc..47689febea4 100644 --- a/api/datadogV1/model_organization_create_body.go +++ b/api/datadogV1/model_organization_create_body.go @@ -152,23 +152,12 @@ func (o OrganizationCreateBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Billing *OrganizationBilling `json:"billing,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Subscription *OrganizationSubscription `json:"subscription,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -176,6 +165,9 @@ func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"billing", "name", "subscription"}) @@ -190,7 +182,7 @@ func (o *OrganizationCreateBody) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Billing = all.Billing - o.Name = all.Name + o.Name = *all.Name if all.Subscription != nil && all.Subscription.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_organization_create_response.go b/api/datadogV1/model_organization_create_response.go index 2ba8c1b1a2e..34ea09671e6 100644 --- a/api/datadogV1/model_organization_create_response.go +++ b/api/datadogV1/model_organization_create_response.go @@ -188,8 +188,7 @@ func (o *OrganizationCreateResponse) UnmarshalJSON(bytes []byte) (err error) { Org *Organization `json:"org,omitempty"` User *User `json:"user,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_list_response.go b/api/datadogV1/model_organization_list_response.go index 76df4af6a39..1165ee832e5 100644 --- a/api/datadogV1/model_organization_list_response.go +++ b/api/datadogV1/model_organization_list_response.go @@ -86,8 +86,7 @@ func (o *OrganizationListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Orgs []Organization `json:"orgs,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_response.go b/api/datadogV1/model_organization_response.go index f84f80441e5..da9d66fea28 100644 --- a/api/datadogV1/model_organization_response.go +++ b/api/datadogV1/model_organization_response.go @@ -86,8 +86,7 @@ func (o *OrganizationResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Org *Organization `json:"org,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_settings.go b/api/datadogV1/model_organization_settings.go index 5e687ab17e1..03e6c83a0e6 100644 --- a/api/datadogV1/model_organization_settings.go +++ b/api/datadogV1/model_organization_settings.go @@ -397,8 +397,7 @@ func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) { SamlLoginUrl *string `json:"saml_login_url,omitempty"` SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_settings_saml.go b/api/datadogV1/model_organization_settings_saml.go index ec7a84cba7f..d61d53869c4 100644 --- a/api/datadogV1/model_organization_settings_saml.go +++ b/api/datadogV1/model_organization_settings_saml.go @@ -87,8 +87,7 @@ func (o *OrganizationSettingsSaml) UnmarshalJSON(bytes []byte) (err error) { all := struct { Enabled *bool `json:"enabled,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go b/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go index 197011574c3..eaee1904274 100644 --- a/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go +++ b/api/datadogV1/model_organization_settings_saml_autocreate_users_domains.go @@ -120,8 +120,7 @@ func (o *OrganizationSettingsSamlAutocreateUsersDomains) UnmarshalJSON(bytes []b Domains []string `json:"domains,omitempty"` Enabled *bool `json:"enabled,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go b/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go index 639657dd0ad..b9f426ffac9 100644 --- a/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go +++ b/api/datadogV1/model_organization_settings_saml_idp_initiated_login.go @@ -87,8 +87,7 @@ func (o *OrganizationSettingsSamlIdpInitiatedLogin) UnmarshalJSON(bytes []byte) all := struct { Enabled *bool `json:"enabled,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_settings_saml_strict_mode.go b/api/datadogV1/model_organization_settings_saml_strict_mode.go index c4dab4809d7..cbdc1515e16 100644 --- a/api/datadogV1/model_organization_settings_saml_strict_mode.go +++ b/api/datadogV1/model_organization_settings_saml_strict_mode.go @@ -87,8 +87,7 @@ func (o *OrganizationSettingsSamlStrictMode) UnmarshalJSON(bytes []byte) (err er all := struct { Enabled *bool `json:"enabled,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_organization_subscription.go b/api/datadogV1/model_organization_subscription.go index 373bc9c0323..c294f39f274 100644 --- a/api/datadogV1/model_organization_subscription.go +++ b/api/datadogV1/model_organization_subscription.go @@ -88,8 +88,7 @@ func (o *OrganizationSubscription) UnmarshalJSON(bytes []byte) (err error) { all := struct { Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_pager_duty_service.go b/api/datadogV1/model_pager_duty_service.go index 532a07f189d..b217a0de26a 100644 --- a/api/datadogV1/model_pager_duty_service.go +++ b/api/datadogV1/model_pager_duty_service.go @@ -105,26 +105,11 @@ func (o PagerDutyService) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PagerDutyService) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ServiceKey *string `json:"service_key"` ServiceName *string `json:"service_name"` }{} - all := struct { - ServiceKey string `json:"service_key"` - ServiceName string `json:"service_name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceKey == nil { - return fmt.Errorf("required field service_key missing") - } - if required.ServiceName == nil { - return fmt.Errorf("required field service_name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *PagerDutyService) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ServiceKey == nil { + return fmt.Errorf("required field service_key missing") + } + if all.ServiceName == nil { + return fmt.Errorf("required field service_name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"service_key", "service_name"}) } else { return err } - o.ServiceKey = all.ServiceKey - o.ServiceName = all.ServiceName + o.ServiceKey = *all.ServiceKey + o.ServiceName = *all.ServiceName if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_pager_duty_service_key.go b/api/datadogV1/model_pager_duty_service_key.go index 6367b478207..7b5bc34af50 100644 --- a/api/datadogV1/model_pager_duty_service_key.go +++ b/api/datadogV1/model_pager_duty_service_key.go @@ -78,21 +78,10 @@ func (o PagerDutyServiceKey) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PagerDutyServiceKey) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ServiceKey *string `json:"service_key"` - }{} all := struct { - ServiceKey string `json:"service_key"` + ServiceKey *string `json:"service_key"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceKey == nil { - return fmt.Errorf("required field service_key missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *PagerDutyServiceKey) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ServiceKey == nil { + return fmt.Errorf("required field service_key missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"service_key"}) } else { return err } - o.ServiceKey = all.ServiceKey + o.ServiceKey = *all.ServiceKey if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_pager_duty_service_name.go b/api/datadogV1/model_pager_duty_service_name.go index f0ae6b4cdd8..9454e7e26f3 100644 --- a/api/datadogV1/model_pager_duty_service_name.go +++ b/api/datadogV1/model_pager_duty_service_name.go @@ -78,21 +78,10 @@ func (o PagerDutyServiceName) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *PagerDutyServiceName) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ServiceName *string `json:"service_name"` - }{} all := struct { - ServiceName string `json:"service_name"` + ServiceName *string `json:"service_name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceName == nil { - return fmt.Errorf("required field service_name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *PagerDutyServiceName) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ServiceName == nil { + return fmt.Errorf("required field service_name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"service_name"}) } else { return err } - o.ServiceName = all.ServiceName + o.ServiceName = *all.ServiceName if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_pagination.go b/api/datadogV1/model_pagination.go index 64dcaf35f1a..389c00ed0a2 100644 --- a/api/datadogV1/model_pagination.go +++ b/api/datadogV1/model_pagination.go @@ -120,8 +120,7 @@ func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_process_query_definition.go b/api/datadogV1/model_process_query_definition.go index 8ebd5eb0c8d..efc2fba247d 100644 --- a/api/datadogV1/model_process_query_definition.go +++ b/api/datadogV1/model_process_query_definition.go @@ -177,24 +177,13 @@ func (o ProcessQueryDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - }{} all := struct { FilterBy []string `json:"filter_by,omitempty"` Limit *int64 `json:"limit,omitempty"` - Metric string `json:"metric"` + Metric *string `json:"metric"` SearchBy *string `json:"search_by,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("required field metric missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +191,9 @@ func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Metric == nil { + return fmt.Errorf("required field metric missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"filter_by", "limit", "metric", "search_by"}) @@ -210,7 +202,7 @@ func (o *ProcessQueryDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.FilterBy = all.FilterBy o.Limit = all.Limit - o.Metric = all.Metric + o.Metric = *all.Metric o.SearchBy = all.SearchBy if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_query_value_widget_definition.go b/api/datadogV1/model_query_value_widget_definition.go index dd6408cd02f..61d46f5916a 100644 --- a/api/datadogV1/model_query_value_widget_definition.go +++ b/api/datadogV1/model_query_value_widget_definition.go @@ -437,36 +437,21 @@ func (o QueryValueWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]QueryValueWidgetRequest `json:"requests"` - Type *QueryValueWidgetDefinitionType `json:"type"` - }{} all := struct { - Autoscale *bool `json:"autoscale,omitempty"` - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - CustomUnit *string `json:"custom_unit,omitempty"` - Precision *int64 `json:"precision,omitempty"` - Requests []QueryValueWidgetRequest `json:"requests"` - TextAlign *WidgetTextAlign `json:"text_align,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - TimeseriesBackground *TimeseriesBackground `json:"timeseries_background,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type QueryValueWidgetDefinitionType `json:"type"` + Autoscale *bool `json:"autoscale,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + CustomUnit *string `json:"custom_unit,omitempty"` + Precision *int64 `json:"precision,omitempty"` + Requests *[]QueryValueWidgetRequest `json:"requests"` + TextAlign *WidgetTextAlign `json:"text_align,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + TimeseriesBackground *TimeseriesBackground `json:"timeseries_background,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *QueryValueWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -474,6 +459,12 @@ func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"autoscale", "custom_links", "custom_unit", "precision", "requests", "text_align", "time", "timeseries_background", "title", "title_align", "title_size", "type"}) @@ -508,7 +499,7 @@ func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.CustomLinks = all.CustomLinks o.CustomUnit = all.CustomUnit o.Precision = all.Precision - o.Requests = all.Requests + o.Requests = *all.Requests o.TextAlign = all.TextAlign if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -529,7 +520,7 @@ func (o *QueryValueWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_query_value_widget_request.go b/api/datadogV1/model_query_value_widget_request.go index 0b6dc9115f2..59e1de15ea5 100644 --- a/api/datadogV1/model_query_value_widget_request.go +++ b/api/datadogV1/model_query_value_widget_request.go @@ -562,8 +562,7 @@ func (o *QueryValueWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_reference_table_logs_lookup_processor.go b/api/datadogV1/model_reference_table_logs_lookup_processor.go index d7e23284466..ac5f3a3132c 100644 --- a/api/datadogV1/model_reference_table_logs_lookup_processor.go +++ b/api/datadogV1/model_reference_table_logs_lookup_processor.go @@ -237,45 +237,34 @@ func (o ReferenceTableLogsLookupProcessor) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ReferenceTableLogsLookupProcessor) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` LookupEnrichmentTable *string `json:"lookup_enrichment_table"` + Name *string `json:"name,omitempty"` Source *string `json:"source"` Target *string `json:"target"` Type *LogsLookupProcessorType `json:"type"` }{} - all := struct { - IsEnabled *bool `json:"is_enabled,omitempty"` - LookupEnrichmentTable string `json:"lookup_enrichment_table"` - Name *string `json:"name,omitempty"` - Source string `json:"source"` - Target string `json:"target"` - Type LogsLookupProcessorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.LookupEnrichmentTable == nil { + if all.LookupEnrichmentTable == nil { return fmt.Errorf("required field lookup_enrichment_table missing") } - if required.Source == nil { + if all.Source == nil { return fmt.Errorf("required field source missing") } - if required.Target == nil { + if all.Target == nil { return fmt.Errorf("required field target missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "lookup_enrichment_table", "name", "source", "target", "type"}) @@ -291,11 +280,11 @@ func (o *ReferenceTableLogsLookupProcessor) UnmarshalJSON(bytes []byte) (err err return nil } o.IsEnabled = all.IsEnabled - o.LookupEnrichmentTable = all.LookupEnrichmentTable + o.LookupEnrichmentTable = *all.LookupEnrichmentTable o.Name = all.Name - o.Source = all.Source - o.Target = all.Target - o.Type = all.Type + o.Source = *all.Source + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_response_meta_attributes.go b/api/datadogV1/model_response_meta_attributes.go index eea80f6546b..28d56dca5f1 100644 --- a/api/datadogV1/model_response_meta_attributes.go +++ b/api/datadogV1/model_response_meta_attributes.go @@ -86,8 +86,7 @@ func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *Pagination `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_run_workflow_widget_definition.go b/api/datadogV1/model_run_workflow_widget_definition.go index e7391c64735..304af0ea05f 100644 --- a/api/datadogV1/model_run_workflow_widget_definition.go +++ b/api/datadogV1/model_run_workflow_widget_definition.go @@ -305,32 +305,17 @@ func (o RunWorkflowWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *RunWorkflowWidgetDefinitionType `json:"type"` - WorkflowId *string `json:"workflow_id"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Inputs []RunWorkflowWidgetInput `json:"inputs,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type RunWorkflowWidgetDefinitionType `json:"type"` - WorkflowId string `json:"workflow_id"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Inputs []RunWorkflowWidgetInput `json:"inputs,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *RunWorkflowWidgetDefinitionType `json:"type"` + WorkflowId *string `json:"workflow_id"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.WorkflowId == nil { - return fmt.Errorf("required field workflow_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -338,6 +323,12 @@ func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.WorkflowId == nil { + return fmt.Errorf("required field workflow_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "inputs", "time", "title", "title_align", "title_size", "type", "workflow_id"}) @@ -373,8 +364,8 @@ func (o *RunWorkflowWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type - o.WorkflowId = all.WorkflowId + o.Type = *all.Type + o.WorkflowId = *all.WorkflowId if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_run_workflow_widget_input.go b/api/datadogV1/model_run_workflow_widget_input.go index 14c5405bba3..5d045f794b1 100644 --- a/api/datadogV1/model_run_workflow_widget_input.go +++ b/api/datadogV1/model_run_workflow_widget_input.go @@ -105,26 +105,11 @@ func (o RunWorkflowWidgetInput) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RunWorkflowWidgetInput) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Name *string `json:"name"` Value *string `json:"value"` }{} - all := struct { - Name string `json:"name"` - Value string `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Value == nil { - return fmt.Errorf("required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *RunWorkflowWidgetInput) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "value"}) } else { return err } - o.Name = all.Name - o.Value = all.Value + o.Name = *all.Name + o.Value = *all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_scatter_plot_request.go b/api/datadogV1/model_scatter_plot_request.go index 09c30583d86..65fb6d0f819 100644 --- a/api/datadogV1/model_scatter_plot_request.go +++ b/api/datadogV1/model_scatter_plot_request.go @@ -392,8 +392,7 @@ func (o *ScatterPlotRequest) UnmarshalJSON(bytes []byte) (err error) { RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_scatter_plot_widget_definition.go b/api/datadogV1/model_scatter_plot_widget_definition.go index ef6eb5c0957..2713fa43797 100644 --- a/api/datadogV1/model_scatter_plot_widget_definition.go +++ b/api/datadogV1/model_scatter_plot_widget_definition.go @@ -371,34 +371,19 @@ func (o ScatterPlotWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *ScatterPlotWidgetDefinitionRequests `json:"requests"` - Type *ScatterPlotWidgetDefinitionType `json:"type"` - }{} all := struct { - ColorByGroups []string `json:"color_by_groups,omitempty"` - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests ScatterPlotWidgetDefinitionRequests `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ScatterPlotWidgetDefinitionType `json:"type"` - Xaxis *WidgetAxis `json:"xaxis,omitempty"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` + ColorByGroups []string `json:"color_by_groups,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests *ScatterPlotWidgetDefinitionRequests `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *ScatterPlotWidgetDefinitionType `json:"type"` + Xaxis *WidgetAxis `json:"xaxis,omitempty"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -406,6 +391,12 @@ func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"color_by_groups", "custom_links", "requests", "time", "title", "title_align", "title_size", "type", "xaxis", "yaxis"}) @@ -437,7 +428,7 @@ func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Requests = all.Requests + o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -449,7 +440,7 @@ func (o *ScatterPlotWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_scatter_plot_widget_definition_requests.go b/api/datadogV1/model_scatter_plot_widget_definition_requests.go index a3458e9cf91..f60d47f0103 100644 --- a/api/datadogV1/model_scatter_plot_widget_definition_requests.go +++ b/api/datadogV1/model_scatter_plot_widget_definition_requests.go @@ -154,8 +154,7 @@ func (o *ScatterPlotWidgetDefinitionRequests) UnmarshalJSON(bytes []byte) (err e X *ScatterPlotRequest `json:"x,omitempty"` Y *ScatterPlotRequest `json:"y,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_scatterplot_table_request.go b/api/datadogV1/model_scatterplot_table_request.go index 2e91648627f..77e3f4e814f 100644 --- a/api/datadogV1/model_scatterplot_table_request.go +++ b/api/datadogV1/model_scatterplot_table_request.go @@ -154,8 +154,7 @@ func (o *ScatterplotTableRequest) UnmarshalJSON(bytes []byte) (err error) { Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_scatterplot_widget_formula.go b/api/datadogV1/model_scatterplot_widget_formula.go index 870381c76a0..df205f81cfb 100644 --- a/api/datadogV1/model_scatterplot_widget_formula.go +++ b/api/datadogV1/model_scatterplot_widget_formula.go @@ -138,27 +138,12 @@ func (o ScatterplotWidgetFormula) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { + Alias *string `json:"alias,omitempty"` Dimension *ScatterplotDimension `json:"dimension"` Formula *string `json:"formula"` }{} - all := struct { - Alias *string `json:"alias,omitempty"` - Dimension ScatterplotDimension `json:"dimension"` - Formula string `json:"formula"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Dimension == nil { - return fmt.Errorf("required field dimension missing") - } - if required.Formula == nil { - return fmt.Errorf("required field formula missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Dimension == nil { + return fmt.Errorf("required field dimension missing") + } + if all.Formula == nil { + return fmt.Errorf("required field formula missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"alias", "dimension", "formula"}) @@ -181,8 +172,8 @@ func (o *ScatterplotWidgetFormula) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Alias = all.Alias - o.Dimension = all.Dimension - o.Formula = all.Formula + o.Dimension = *all.Dimension + o.Formula = *all.Formula if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_search_service_level_objective.go b/api/datadogV1/model_search_service_level_objective.go index 92645101741..ee112561d37 100644 --- a/api/datadogV1/model_search_service_level_objective.go +++ b/api/datadogV1/model_search_service_level_objective.go @@ -86,8 +86,7 @@ func (o *SearchServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *SearchServiceLevelObjectiveData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_service_level_objective_attributes.go b/api/datadogV1/model_search_service_level_objective_attributes.go index e4727e8ffed..8fc6e8d8f5f 100644 --- a/api/datadogV1/model_search_service_level_objective_attributes.go +++ b/api/datadogV1/model_search_service_level_objective_attributes.go @@ -665,8 +665,7 @@ func (o *SearchServiceLevelObjectiveAttributes) UnmarshalJSON(bytes []byte) (err TeamTags []string `json:"team_tags,omitempty"` Thresholds []SearchSLOThreshold `json:"thresholds,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_service_level_objective_data.go b/api/datadogV1/model_search_service_level_objective_data.go index b389aed40e7..b4578e1d767 100644 --- a/api/datadogV1/model_search_service_level_objective_data.go +++ b/api/datadogV1/model_search_service_level_objective_data.go @@ -157,8 +157,7 @@ func (o *SearchServiceLevelObjectiveData) UnmarshalJSON(bytes []byte) (err error Id *string `json:"id,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_query.go b/api/datadogV1/model_search_slo_query.go index 75780e69af6..39059a2f74a 100644 --- a/api/datadogV1/model_search_slo_query.go +++ b/api/datadogV1/model_search_slo_query.go @@ -168,8 +168,7 @@ func (o *SearchSLOQuery) UnmarshalJSON(bytes []byte) (err error) { Metrics datadog.NullableList[string] `json:"metrics,omitempty"` Numerator *string `json:"numerator,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response.go b/api/datadogV1/model_search_slo_response.go index 0dd205d4196..8c8a1e002af 100644 --- a/api/datadogV1/model_search_slo_response.go +++ b/api/datadogV1/model_search_slo_response.go @@ -154,8 +154,7 @@ func (o *SearchSLOResponse) UnmarshalJSON(bytes []byte) (err error) { Links *SearchSLOResponseLinks `json:"links,omitempty"` Meta *SearchSLOResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_data.go b/api/datadogV1/model_search_slo_response_data.go index 1759b98e5bd..f32e14b2108 100644 --- a/api/datadogV1/model_search_slo_response_data.go +++ b/api/datadogV1/model_search_slo_response_data.go @@ -120,8 +120,7 @@ func (o *SearchSLOResponseData) UnmarshalJSON(bytes []byte) (err error) { Attributes *SearchSLOResponseDataAttributes `json:"attributes,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_data_attributes.go b/api/datadogV1/model_search_slo_response_data_attributes.go index 86b05d396f8..657bccae1db 100644 --- a/api/datadogV1/model_search_slo_response_data_attributes.go +++ b/api/datadogV1/model_search_slo_response_data_attributes.go @@ -120,8 +120,7 @@ func (o *SearchSLOResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error Facets *SearchSLOResponseDataAttributesFacets `json:"facets,omitempty"` Slos []SearchServiceLevelObjective `json:"slos,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_data_attributes_facets.go b/api/datadogV1/model_search_slo_response_data_attributes_facets.go index b399b8b05a2..dbb1f8ab0f5 100644 --- a/api/datadogV1/model_search_slo_response_data_attributes_facets.go +++ b/api/datadogV1/model_search_slo_response_data_attributes_facets.go @@ -324,8 +324,7 @@ func (o *SearchSLOResponseDataAttributesFacets) UnmarshalJSON(bytes []byte) (err TeamTags []SearchSLOResponseDataAttributesFacetsObjectString `json:"team_tags,omitempty"` Timeframe []SearchSLOResponseDataAttributesFacetsObjectString `json:"timeframe,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go b/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go index 72eb557823f..48340fedacf 100644 --- a/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go +++ b/api/datadogV1/model_search_slo_response_data_attributes_facets_object_int.go @@ -120,8 +120,7 @@ func (o *SearchSLOResponseDataAttributesFacetsObjectInt) UnmarshalJSON(bytes []b Count *int64 `json:"count,omitempty"` Name *float64 `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go b/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go index 8764a1f6b7a..14fc57cab39 100644 --- a/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go +++ b/api/datadogV1/model_search_slo_response_data_attributes_facets_object_string.go @@ -120,8 +120,7 @@ func (o *SearchSLOResponseDataAttributesFacetsObjectString) UnmarshalJSON(bytes Count *int64 `json:"count,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_links.go b/api/datadogV1/model_search_slo_response_links.go index da4bded61f1..21e301b5673 100644 --- a/api/datadogV1/model_search_slo_response_links.go +++ b/api/datadogV1/model_search_slo_response_links.go @@ -244,8 +244,7 @@ func (o *SearchSLOResponseLinks) UnmarshalJSON(bytes []byte) (err error) { Prev datadog.NullableString `json:"prev,omitempty"` Self *string `json:"self,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_meta.go b/api/datadogV1/model_search_slo_response_meta.go index ff1e78176b9..3dca03ea628 100644 --- a/api/datadogV1/model_search_slo_response_meta.go +++ b/api/datadogV1/model_search_slo_response_meta.go @@ -86,8 +86,7 @@ func (o *SearchSLOResponseMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Pagination *SearchSLOResponseMetaPage `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_response_meta_page.go b/api/datadogV1/model_search_slo_response_meta_page.go index dd02e0d420d..346cfbc807b 100644 --- a/api/datadogV1/model_search_slo_response_meta_page.go +++ b/api/datadogV1/model_search_slo_response_meta_page.go @@ -324,8 +324,7 @@ func (o *SearchSLOResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { Total *int64 `json:"total,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_search_slo_threshold.go b/api/datadogV1/model_search_slo_threshold.go index 8b4ca1b3037..501c64f4fbc 100644 --- a/api/datadogV1/model_search_slo_threshold.go +++ b/api/datadogV1/model_search_slo_threshold.go @@ -235,29 +235,14 @@ func (o SearchSLOThreshold) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Target *float64 `json:"target"` - Timeframe *SearchSLOTimeframe `json:"timeframe"` - }{} all := struct { - Target float64 `json:"target"` + Target *float64 `json:"target"` TargetDisplay *string `json:"target_display,omitempty"` - Timeframe SearchSLOTimeframe `json:"timeframe"` + Timeframe *SearchSLOTimeframe `json:"timeframe"` Warning datadog.NullableFloat64 `json:"warning,omitempty"` WarningDisplay datadog.NullableString `json:"warning_display,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Timeframe == nil { - return fmt.Errorf("required field timeframe missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -265,6 +250,12 @@ func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Timeframe == nil { + return fmt.Errorf("required field timeframe missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"target", "target_display", "timeframe", "warning", "warning_display"}) @@ -279,9 +270,9 @@ func (o *SearchSLOThreshold) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Target = all.Target + o.Target = *all.Target o.TargetDisplay = all.TargetDisplay - o.Timeframe = all.Timeframe + o.Timeframe = *all.Timeframe o.Warning = all.Warning o.WarningDisplay = all.WarningDisplay if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_selectable_template_variable_items.go b/api/datadogV1/model_selectable_template_variable_items.go index 86cf5c4f7d9..391e07f5107 100644 --- a/api/datadogV1/model_selectable_template_variable_items.go +++ b/api/datadogV1/model_selectable_template_variable_items.go @@ -199,8 +199,7 @@ func (o *SelectableTemplateVariableItems) UnmarshalJSON(bytes []byte) (err error Prefix *string `json:"prefix,omitempty"` VisibleTags datadog.NullableList[string] `json:"visible_tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_series.go b/api/datadogV1/model_series.go index fd1eba849e0..a3e274cfc4f 100644 --- a/api/datadogV1/model_series.go +++ b/api/datadogV1/model_series.go @@ -255,30 +255,15 @@ func (o Series) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Series) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - Points *[][]*float64 `json:"points"` - }{} all := struct { Host *string `json:"host,omitempty"` Interval datadog.NullableInt64 `json:"interval,omitempty"` - Metric string `json:"metric"` - Points [][]*float64 `json:"points"` + Metric *string `json:"metric"` + Points *[][]*float64 `json:"points"` Tags []string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("required field metric missing") - } - if required.Points == nil { - return fmt.Errorf("required field points missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -286,6 +271,12 @@ func (o *Series) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Metric == nil { + return fmt.Errorf("required field metric missing") + } + if all.Points == nil { + return fmt.Errorf("required field points missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"host", "interval", "metric", "points", "tags", "type"}) @@ -294,8 +285,8 @@ func (o *Series) UnmarshalJSON(bytes []byte) (err error) { } o.Host = all.Host o.Interval = all.Interval - o.Metric = all.Metric - o.Points = all.Points + o.Metric = *all.Metric + o.Points = *all.Points o.Tags = all.Tags o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_service_check.go b/api/datadogV1/model_service_check.go index c90ca8cd84b..e1b4d2d40e0 100644 --- a/api/datadogV1/model_service_check.go +++ b/api/datadogV1/model_service_check.go @@ -225,45 +225,34 @@ func (o ServiceCheck) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Check *string `json:"check"` - HostName *string `json:"host_name"` - Status *ServiceCheckStatus `json:"status"` - Tags *[]string `json:"tags"` - }{} all := struct { - Check string `json:"check"` - HostName string `json:"host_name"` - Message *string `json:"message,omitempty"` - Status ServiceCheckStatus `json:"status"` - Tags []string `json:"tags"` - Timestamp *int64 `json:"timestamp,omitempty"` + Check *string `json:"check"` + HostName *string `json:"host_name"` + Message *string `json:"message,omitempty"` + Status *ServiceCheckStatus `json:"status"` + Tags *[]string `json:"tags"` + Timestamp *int64 `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Check == nil { + if all.Check == nil { return fmt.Errorf("required field check missing") } - if required.HostName == nil { + if all.HostName == nil { return fmt.Errorf("required field host_name missing") } - if required.Status == nil { + if all.Status == nil { return fmt.Errorf("required field status missing") } - if required.Tags == nil { + if all.Tags == nil { return fmt.Errorf("required field tags missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"check", "host_name", "message", "status", "tags", "timestamp"}) @@ -278,11 +267,11 @@ func (o *ServiceCheck) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Check = all.Check - o.HostName = all.HostName + o.Check = *all.Check + o.HostName = *all.HostName o.Message = all.Message - o.Status = all.Status - o.Tags = all.Tags + o.Status = *all.Status + o.Tags = *all.Tags o.Timestamp = all.Timestamp if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_service_level_objective.go b/api/datadogV1/model_service_level_objective.go index e58c9afe3af..b03c0c0bc63 100644 --- a/api/datadogV1/model_service_level_objective.go +++ b/api/datadogV1/model_service_level_objective.go @@ -601,11 +601,6 @@ func (o ServiceLevelObjective) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Thresholds *[]SLOThreshold `json:"thresholds"` - Type *SLOType `json:"type"` - }{} all := struct { CreatedAt *int64 `json:"created_at,omitempty"` Creator *Creator `json:"creator,omitempty"` @@ -615,30 +610,16 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { ModifiedAt *int64 `json:"modified_at,omitempty"` MonitorIds []int64 `json:"monitor_ids,omitempty"` MonitorTags []string `json:"monitor_tags,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` Tags []string `json:"tags,omitempty"` TargetThreshold *float64 `json:"target_threshold,omitempty"` - Thresholds []SLOThreshold `json:"thresholds"` + Thresholds *[]SLOThreshold `json:"thresholds"` Timeframe *SLOTimeframe `json:"timeframe,omitempty"` - Type SLOType `json:"type"` + Type *SLOType `json:"type"` WarningThreshold *float64 `json:"warning_threshold,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Thresholds == nil { - return fmt.Errorf("required field thresholds missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -646,6 +627,15 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Thresholds == nil { + return fmt.Errorf("required field thresholds missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "creator", "description", "groups", "id", "modified_at", "monitor_ids", "monitor_tags", "name", "query", "tags", "target_threshold", "thresholds", "timeframe", "type", "warning_threshold"}) @@ -683,7 +673,7 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { o.ModifiedAt = all.ModifiedAt o.MonitorIds = all.MonitorIds o.MonitorTags = all.MonitorTags - o.Name = all.Name + o.Name = *all.Name if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -694,9 +684,9 @@ func (o *ServiceLevelObjective) UnmarshalJSON(bytes []byte) (err error) { o.Query = all.Query o.Tags = all.Tags o.TargetThreshold = all.TargetThreshold - o.Thresholds = all.Thresholds + o.Thresholds = *all.Thresholds o.Timeframe = all.Timeframe - o.Type = all.Type + o.Type = *all.Type o.WarningThreshold = all.WarningThreshold if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_service_level_objective_query.go b/api/datadogV1/model_service_level_objective_query.go index 352f1b42ec1..cc8284ebd56 100644 --- a/api/datadogV1/model_service_level_objective_query.go +++ b/api/datadogV1/model_service_level_objective_query.go @@ -107,26 +107,11 @@ func (o ServiceLevelObjectiveQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceLevelObjectiveQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Denominator *string `json:"denominator"` Numerator *string `json:"numerator"` }{} - all := struct { - Denominator string `json:"denominator"` - Numerator string `json:"numerator"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Denominator == nil { - return fmt.Errorf("required field denominator missing") - } - if required.Numerator == nil { - return fmt.Errorf("required field numerator missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,14 +119,20 @@ func (o *ServiceLevelObjectiveQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Denominator == nil { + return fmt.Errorf("required field denominator missing") + } + if all.Numerator == nil { + return fmt.Errorf("required field numerator missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"denominator", "numerator"}) } else { return err } - o.Denominator = all.Denominator - o.Numerator = all.Numerator + o.Denominator = *all.Denominator + o.Numerator = *all.Numerator if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_service_level_objective_request.go b/api/datadogV1/model_service_level_objective_request.go index 669278dcba5..940e538ab20 100644 --- a/api/datadogV1/model_service_level_objective_request.go +++ b/api/datadogV1/model_service_level_objective_request.go @@ -425,39 +425,20 @@ func (o ServiceLevelObjectiveRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Thresholds *[]SLOThreshold `json:"thresholds"` - Type *SLOType `json:"type"` - }{} all := struct { Description datadog.NullableString `json:"description,omitempty"` Groups []string `json:"groups,omitempty"` MonitorIds []int64 `json:"monitor_ids,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Query *ServiceLevelObjectiveQuery `json:"query,omitempty"` Tags []string `json:"tags,omitempty"` TargetThreshold *float64 `json:"target_threshold,omitempty"` - Thresholds []SLOThreshold `json:"thresholds"` + Thresholds *[]SLOThreshold `json:"thresholds"` Timeframe *SLOTimeframe `json:"timeframe,omitempty"` - Type SLOType `json:"type"` + Type *SLOType `json:"type"` WarningThreshold *float64 `json:"warning_threshold,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Thresholds == nil { - return fmt.Errorf("required field thresholds missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -465,6 +446,15 @@ func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Thresholds == nil { + return fmt.Errorf("required field thresholds missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"description", "groups", "monitor_ids", "name", "query", "tags", "target_threshold", "thresholds", "timeframe", "type", "warning_threshold"}) @@ -490,7 +480,7 @@ func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { o.Description = all.Description o.Groups = all.Groups o.MonitorIds = all.MonitorIds - o.Name = all.Name + o.Name = *all.Name if all.Query != nil && all.Query.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -501,9 +491,9 @@ func (o *ServiceLevelObjectiveRequest) UnmarshalJSON(bytes []byte) (err error) { o.Query = all.Query o.Tags = all.Tags o.TargetThreshold = all.TargetThreshold - o.Thresholds = all.Thresholds + o.Thresholds = *all.Thresholds o.Timeframe = all.Timeframe - o.Type = all.Type + o.Type = *all.Type o.WarningThreshold = all.WarningThreshold if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_service_map_widget_definition.go b/api/datadogV1/model_service_map_widget_definition.go index 83e281545b9..1c50116abb3 100644 --- a/api/datadogV1/model_service_map_widget_definition.go +++ b/api/datadogV1/model_service_map_widget_definition.go @@ -266,35 +266,16 @@ func (o ServiceMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Filters *[]string `json:"filters"` - Service *string `json:"service"` - Type *ServiceMapWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Filters []string `json:"filters"` - Service string `json:"service"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ServiceMapWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Filters *[]string `json:"filters"` + Service *string `json:"service"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *ServiceMapWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Filters == nil { - return fmt.Errorf("required field filters missing") - } - if required.Service == nil { - return fmt.Errorf("required field service missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -302,6 +283,15 @@ func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Filters == nil { + return fmt.Errorf("required field filters missing") + } + if all.Service == nil { + return fmt.Errorf("required field service missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "filters", "service", "title", "title_align", "title_size", "type"}) @@ -325,12 +315,12 @@ func (o *ServiceMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.CustomLinks = all.CustomLinks - o.Filters = all.Filters - o.Service = all.Service + o.Filters = *all.Filters + o.Service = *all.Service o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_service_summary_widget_definition.go b/api/datadogV1/model_service_summary_widget_definition.go index 8e39484d6cf..43170889b1e 100644 --- a/api/datadogV1/model_service_summary_widget_definition.go +++ b/api/datadogV1/model_service_summary_widget_definition.go @@ -557,55 +557,44 @@ func (o ServiceSummaryWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Env *string `json:"env"` - Service *string `json:"service"` - SpanName *string `json:"span_name"` - Type *ServiceSummaryWidgetDefinitionType `json:"type"` - }{} all := struct { - DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` - Env string `json:"env"` - Service string `json:"service"` - ShowBreakdown *bool `json:"show_breakdown,omitempty"` - ShowDistribution *bool `json:"show_distribution,omitempty"` - ShowErrors *bool `json:"show_errors,omitempty"` - ShowHits *bool `json:"show_hits,omitempty"` - ShowLatency *bool `json:"show_latency,omitempty"` - ShowResourceList *bool `json:"show_resource_list,omitempty"` - SizeFormat *WidgetSizeFormat `json:"size_format,omitempty"` - SpanName string `json:"span_name"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ServiceSummaryWidgetDefinitionType `json:"type"` + DisplayFormat *WidgetServiceSummaryDisplayFormat `json:"display_format,omitempty"` + Env *string `json:"env"` + Service *string `json:"service"` + ShowBreakdown *bool `json:"show_breakdown,omitempty"` + ShowDistribution *bool `json:"show_distribution,omitempty"` + ShowErrors *bool `json:"show_errors,omitempty"` + ShowHits *bool `json:"show_hits,omitempty"` + ShowLatency *bool `json:"show_latency,omitempty"` + ShowResourceList *bool `json:"show_resource_list,omitempty"` + SizeFormat *WidgetSizeFormat `json:"size_format,omitempty"` + SpanName *string `json:"span_name"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *ServiceSummaryWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Env == nil { + if all.Env == nil { return fmt.Errorf("required field env missing") } - if required.Service == nil { + if all.Service == nil { return fmt.Errorf("required field service missing") } - if required.SpanName == nil { + if all.SpanName == nil { return fmt.Errorf("required field span_name missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"display_format", "env", "service", "show_breakdown", "show_distribution", "show_errors", "show_hits", "show_latency", "show_resource_list", "size_format", "span_name", "time", "title", "title_align", "title_size", "type"}) @@ -645,8 +634,8 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) return nil } o.DisplayFormat = all.DisplayFormat - o.Env = all.Env - o.Service = all.Service + o.Env = *all.Env + o.Service = *all.Service o.ShowBreakdown = all.ShowBreakdown o.ShowDistribution = all.ShowDistribution o.ShowErrors = all.ShowErrors @@ -654,7 +643,7 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.ShowLatency = all.ShowLatency o.ShowResourceList = all.ShowResourceList o.SizeFormat = all.SizeFormat - o.SpanName = all.SpanName + o.SpanName = *all.SpanName if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -666,7 +655,7 @@ func (o *ServiceSummaryWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_shared_dashboard.go b/api/datadogV1/model_shared_dashboard.go index b1af790b9e5..7d0917ec45a 100644 --- a/api/datadogV1/model_shared_dashboard.go +++ b/api/datadogV1/model_shared_dashboard.go @@ -441,15 +441,11 @@ func (o SharedDashboard) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DashboardId *string `json:"dashboard_id"` - DashboardType *DashboardType `json:"dashboard_type"` - }{} all := struct { Author *SharedDashboardAuthor `json:"author,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` - DashboardId string `json:"dashboard_id"` - DashboardType DashboardType `json:"dashboard_type"` + DashboardId *string `json:"dashboard_id"` + DashboardType *DashboardType `json:"dashboard_type"` GlobalTime *DashboardGlobalTime `json:"global_time,omitempty"` GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` PublicUrl *string `json:"public_url,omitempty"` @@ -458,18 +454,7 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { ShareType NullableDashboardShareType `json:"share_type,omitempty"` Token *string `json:"token,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DashboardId == nil { - return fmt.Errorf("required field dashboard_id missing") - } - if required.DashboardType == nil { - return fmt.Errorf("required field dashboard_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -477,6 +462,12 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DashboardId == nil { + return fmt.Errorf("required field dashboard_id missing") + } + if all.DashboardType == nil { + return fmt.Errorf("required field dashboard_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author", "created_at", "dashboard_id", "dashboard_type", "global_time", "global_time_selectable_enabled", "public_url", "selectable_template_vars", "share_list", "share_type", "token"}) @@ -508,8 +499,8 @@ func (o *SharedDashboard) UnmarshalJSON(bytes []byte) (err error) { } o.Author = all.Author o.CreatedAt = all.CreatedAt - o.DashboardId = all.DashboardId - o.DashboardType = all.DashboardType + o.DashboardId = *all.DashboardId + o.DashboardType = *all.DashboardType if all.GlobalTime != nil && all.GlobalTime.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_shared_dashboard_author.go b/api/datadogV1/model_shared_dashboard_author.go index 167f1d8a5a1..0ba50a1a225 100644 --- a/api/datadogV1/model_shared_dashboard_author.go +++ b/api/datadogV1/model_shared_dashboard_author.go @@ -131,8 +131,7 @@ func (o *SharedDashboardAuthor) UnmarshalJSON(bytes []byte) (err error) { Handle *string `json:"handle,omitempty"` Name datadog.NullableString `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_shared_dashboard_invites.go b/api/datadogV1/model_shared_dashboard_invites.go index 3c70ac80279..4ddd1ad3f63 100644 --- a/api/datadogV1/model_shared_dashboard_invites.go +++ b/api/datadogV1/model_shared_dashboard_invites.go @@ -111,22 +111,11 @@ func (o SharedDashboardInvites) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvites) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SharedDashboardInvitesData `json:"data"` - }{} all := struct { - Data SharedDashboardInvitesData `json:"data"` + Data *SharedDashboardInvitesData `json:"data"` Meta *SharedDashboardInvitesMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *SharedDashboardInvites) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_shared_dashboard_invites_data_object.go b/api/datadogV1/model_shared_dashboard_invites_data_object.go index 52101e73d0c..08b6d020eda 100644 --- a/api/datadogV1/model_shared_dashboard_invites_data_object.go +++ b/api/datadogV1/model_shared_dashboard_invites_data_object.go @@ -105,26 +105,11 @@ func (o SharedDashboardInvitesDataObject) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardInvitesDataObject) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *SharedDashboardInvitesDataObjectAttributes `json:"attributes"` Type *DashboardInviteType `json:"type"` }{} - all := struct { - Attributes SharedDashboardInvitesDataObjectAttributes `json:"attributes"` - Type DashboardInviteType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SharedDashboardInvitesDataObject) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -153,8 +144,8 @@ func (o *SharedDashboardInvitesDataObject) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go b/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go index 6045c573b9b..ab781733301 100644 --- a/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go +++ b/api/datadogV1/model_shared_dashboard_invites_data_object_attributes.go @@ -276,8 +276,7 @@ func (o *SharedDashboardInvitesDataObjectAttributes) UnmarshalJSON(bytes []byte) SessionExpiry datadog.NullableTime `json:"session_expiry,omitempty"` ShareToken *string `json:"share_token,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_shared_dashboard_invites_meta.go b/api/datadogV1/model_shared_dashboard_invites_meta.go index 8794774efd6..62edebe6bb4 100644 --- a/api/datadogV1/model_shared_dashboard_invites_meta.go +++ b/api/datadogV1/model_shared_dashboard_invites_meta.go @@ -86,8 +86,7 @@ func (o *SharedDashboardInvitesMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *SharedDashboardInvitesMetaPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_shared_dashboard_invites_meta_page.go b/api/datadogV1/model_shared_dashboard_invites_meta_page.go index eee50cec868..f1aaa7c09af 100644 --- a/api/datadogV1/model_shared_dashboard_invites_meta_page.go +++ b/api/datadogV1/model_shared_dashboard_invites_meta_page.go @@ -86,8 +86,7 @@ func (o *SharedDashboardInvitesMetaPage) UnmarshalJSON(bytes []byte) (err error) all := struct { TotalCount *int64 `json:"total_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_shared_dashboard_update_request.go b/api/datadogV1/model_shared_dashboard_update_request.go index 26a42bb356c..1cfbbad4b2f 100644 --- a/api/datadogV1/model_shared_dashboard_update_request.go +++ b/api/datadogV1/model_shared_dashboard_update_request.go @@ -246,9 +246,6 @@ func (o SharedDashboardUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"` - }{} all := struct { GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"` GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"` @@ -256,15 +253,7 @@ func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { ShareList datadog.NullableList[string] `json:"share_list,omitempty"` ShareType NullableDashboardShareType `json:"share_type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if !required.GlobalTime.IsSet() { - return fmt.Errorf("required field global_time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -272,6 +261,9 @@ func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if !all.GlobalTime.IsSet() { + return fmt.Errorf("required field global_time missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"global_time", "global_time_selectable_enabled", "selectable_template_vars", "share_list", "share_type"}) diff --git a/api/datadogV1/model_shared_dashboard_update_request_global_time.go b/api/datadogV1/model_shared_dashboard_update_request_global_time.go index bc67dda3c2b..9036b82014e 100644 --- a/api/datadogV1/model_shared_dashboard_update_request_global_time.go +++ b/api/datadogV1/model_shared_dashboard_update_request_global_time.go @@ -86,8 +86,7 @@ func (o *SharedDashboardUpdateRequestGlobalTime) UnmarshalJSON(bytes []byte) (er all := struct { LiveSpan *DashboardGlobalTimeLiveSpan `json:"live_span,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_signal_assignee_update_request.go b/api/datadogV1/model_signal_assignee_update_request.go index 18cdf8bc04a..9a9cd871a41 100644 --- a/api/datadogV1/model_signal_assignee_update_request.go +++ b/api/datadogV1/model_signal_assignee_update_request.go @@ -111,22 +111,11 @@ func (o SignalAssigneeUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Assignee *string `json:"assignee"` - }{} all := struct { - Assignee string `json:"assignee"` - Version *int64 `json:"version,omitempty"` + Assignee *string `json:"assignee"` + Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignee == nil { - return fmt.Errorf("required field assignee missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *SignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Assignee == nil { + return fmt.Errorf("required field assignee missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"assignee", "version"}) } else { return err } - o.Assignee = all.Assignee + o.Assignee = *all.Assignee o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_signal_state_update_request.go b/api/datadogV1/model_signal_state_update_request.go index cdb9390666c..11907896acd 100644 --- a/api/datadogV1/model_signal_state_update_request.go +++ b/api/datadogV1/model_signal_state_update_request.go @@ -177,24 +177,13 @@ func (o SignalStateUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - State *SignalTriageState `json:"state"` - }{} all := struct { ArchiveComment *string `json:"archiveComment,omitempty"` ArchiveReason *SignalArchiveReason `json:"archiveReason,omitempty"` - State SignalTriageState `json:"state"` + State *SignalTriageState `json:"state"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.State == nil { - return fmt.Errorf("required field state missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +191,9 @@ func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.State == nil { + return fmt.Errorf("required field state missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"archiveComment", "archiveReason", "state", "version"}) @@ -226,7 +218,7 @@ func (o *SignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.ArchiveComment = all.ArchiveComment o.ArchiveReason = all.ArchiveReason - o.State = all.State + o.State = *all.State o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_slack_integration_channel.go b/api/datadogV1/model_slack_integration_channel.go index 5911bdb1e9c..b753f6c09b0 100644 --- a/api/datadogV1/model_slack_integration_channel.go +++ b/api/datadogV1/model_slack_integration_channel.go @@ -120,8 +120,7 @@ func (o *SlackIntegrationChannel) UnmarshalJSON(bytes []byte) (err error) { Display *SlackIntegrationChannelDisplay `json:"display,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slack_integration_channel_display.go b/api/datadogV1/model_slack_integration_channel_display.go index 59813fef002..7ef7af6cd65 100644 --- a/api/datadogV1/model_slack_integration_channel_display.go +++ b/api/datadogV1/model_slack_integration_channel_display.go @@ -204,8 +204,7 @@ func (o *SlackIntegrationChannelDisplay) UnmarshalJSON(bytes []byte) (err error) Snapshot *bool `json:"snapshot,omitempty"` Tags *bool `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_bulk_delete_error.go b/api/datadogV1/model_slo_bulk_delete_error.go index bf193f67eb7..b52b32a88a3 100644 --- a/api/datadogV1/model_slo_bulk_delete_error.go +++ b/api/datadogV1/model_slo_bulk_delete_error.go @@ -134,31 +134,12 @@ func (o SLOBulkDeleteError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Message *string `json:"message"` Timeframe *SLOErrorTimeframe `json:"timeframe"` }{} - all := struct { - Id string `json:"id"` - Message string `json:"message"` - Timeframe SLOErrorTimeframe `json:"timeframe"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Message == nil { - return fmt.Errorf("required field message missing") - } - if required.Timeframe == nil { - return fmt.Errorf("required field timeframe missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Message == nil { + return fmt.Errorf("required field message missing") + } + if all.Timeframe == nil { + return fmt.Errorf("required field timeframe missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "message", "timeframe"}) @@ -180,9 +170,9 @@ func (o *SLOBulkDeleteError) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Message = all.Message - o.Timeframe = all.Timeframe + o.Id = *all.Id + o.Message = *all.Message + o.Timeframe = *all.Timeframe if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_bulk_delete_response.go b/api/datadogV1/model_slo_bulk_delete_response.go index d99dd8ec4e9..2948a57f3af 100644 --- a/api/datadogV1/model_slo_bulk_delete_response.go +++ b/api/datadogV1/model_slo_bulk_delete_response.go @@ -125,8 +125,7 @@ func (o *SLOBulkDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { Data *SLOBulkDeleteResponseData `json:"data,omitempty"` Errors []SLOBulkDeleteError `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_bulk_delete_response_data.go b/api/datadogV1/model_slo_bulk_delete_response_data.go index 4d0bd85f203..a542778f5f3 100644 --- a/api/datadogV1/model_slo_bulk_delete_response_data.go +++ b/api/datadogV1/model_slo_bulk_delete_response_data.go @@ -123,8 +123,7 @@ func (o *SLOBulkDeleteResponseData) UnmarshalJSON(bytes []byte) (err error) { Deleted []string `json:"deleted,omitempty"` Updated []string `json:"updated,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction.go b/api/datadogV1/model_slo_correction.go index f4f96e8fb53..e1d0b2b52dc 100644 --- a/api/datadogV1/model_slo_correction.go +++ b/api/datadogV1/model_slo_correction.go @@ -158,8 +158,7 @@ func (o *SLOCorrection) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *SLOCorrectionType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_create_data.go b/api/datadogV1/model_slo_correction_create_data.go index b2b01511431..4ec92acb135 100644 --- a/api/datadogV1/model_slo_correction_create_data.go +++ b/api/datadogV1/model_slo_correction_create_data.go @@ -113,22 +113,11 @@ func (o SLOCorrectionCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SLOCorrectionType `json:"type"` - }{} all := struct { Attributes *SLOCorrectionCreateRequestAttributes `json:"attributes,omitempty"` - Type SLOCorrectionType `json:"type"` + Type *SLOCorrectionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -136,6 +125,9 @@ func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -158,7 +150,7 @@ func (o *SLOCorrectionCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_correction_create_request.go b/api/datadogV1/model_slo_correction_create_request.go index 61d24cc2646..6bc9b931fca 100644 --- a/api/datadogV1/model_slo_correction_create_request.go +++ b/api/datadogV1/model_slo_correction_create_request.go @@ -86,8 +86,7 @@ func (o *SLOCorrectionCreateRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *SLOCorrectionCreateData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_create_request_attributes.go b/api/datadogV1/model_slo_correction_create_request_attributes.go index 6147000058d..2ce9d5a9511 100644 --- a/api/datadogV1/model_slo_correction_create_request_attributes.go +++ b/api/datadogV1/model_slo_correction_create_request_attributes.go @@ -298,36 +298,17 @@ func (o SLOCorrectionCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Category *SLOCorrectionCategory `json:"category"` - SloId *string `json:"slo_id"` - Start *int64 `json:"start"` - }{} all := struct { - Category SLOCorrectionCategory `json:"category"` - Description *string `json:"description,omitempty"` - Duration *int64 `json:"duration,omitempty"` - End *int64 `json:"end,omitempty"` - Rrule *string `json:"rrule,omitempty"` - SloId string `json:"slo_id"` - Start int64 `json:"start"` - Timezone *string `json:"timezone,omitempty"` + Category *SLOCorrectionCategory `json:"category"` + Description *string `json:"description,omitempty"` + Duration *int64 `json:"duration,omitempty"` + End *int64 `json:"end,omitempty"` + Rrule *string `json:"rrule,omitempty"` + SloId *string `json:"slo_id"` + Start *int64 `json:"start"` + Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Category == nil { - return fmt.Errorf("required field category missing") - } - if required.SloId == nil { - return fmt.Errorf("required field slo_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -335,6 +316,15 @@ func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Category == nil { + return fmt.Errorf("required field category missing") + } + if all.SloId == nil { + return fmt.Errorf("required field slo_id missing") + } + if all.Start == nil { + return fmt.Errorf("required field start missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"category", "description", "duration", "end", "rrule", "slo_id", "start", "timezone"}) @@ -349,13 +339,13 @@ func (o *SLOCorrectionCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } - o.Category = all.Category + o.Category = *all.Category o.Description = all.Description o.Duration = all.Duration o.End = all.End o.Rrule = all.Rrule - o.SloId = all.SloId - o.Start = all.Start + o.SloId = *all.SloId + o.Start = *all.Start o.Timezone = all.Timezone if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_slo_correction_list_response.go b/api/datadogV1/model_slo_correction_list_response.go index 993ce9fae1d..bcc2abe6c50 100644 --- a/api/datadogV1/model_slo_correction_list_response.go +++ b/api/datadogV1/model_slo_correction_list_response.go @@ -120,8 +120,7 @@ func (o *SLOCorrectionListResponse) UnmarshalJSON(bytes []byte) (err error) { Data []SLOCorrection `json:"data,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_response.go b/api/datadogV1/model_slo_correction_response.go index c7dbc49990b..638476d2538 100644 --- a/api/datadogV1/model_slo_correction_response.go +++ b/api/datadogV1/model_slo_correction_response.go @@ -86,8 +86,7 @@ func (o *SLOCorrectionResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *SLOCorrection `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_response_attributes.go b/api/datadogV1/model_slo_correction_response_attributes.go index a3f111d8916..bb6b2b8ac74 100644 --- a/api/datadogV1/model_slo_correction_response_attributes.go +++ b/api/datadogV1/model_slo_correction_response_attributes.go @@ -527,8 +527,7 @@ func (o *SLOCorrectionResponseAttributes) UnmarshalJSON(bytes []byte) (err error Start *int64 `json:"start,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_response_attributes_modifier.go b/api/datadogV1/model_slo_correction_response_attributes_modifier.go index 1d18b6b0b4b..5647923c4ff 100644 --- a/api/datadogV1/model_slo_correction_response_attributes_modifier.go +++ b/api/datadogV1/model_slo_correction_response_attributes_modifier.go @@ -154,8 +154,7 @@ func (o *SLOCorrectionResponseAttributesModifier) UnmarshalJSON(bytes []byte) (e Handle *string `json:"handle,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_update_data.go b/api/datadogV1/model_slo_correction_update_data.go index e7a393b1e91..6f73ac354d7 100644 --- a/api/datadogV1/model_slo_correction_update_data.go +++ b/api/datadogV1/model_slo_correction_update_data.go @@ -124,8 +124,7 @@ func (o *SLOCorrectionUpdateData) UnmarshalJSON(bytes []byte) (err error) { Attributes *SLOCorrectionUpdateRequestAttributes `json:"attributes,omitempty"` Type *SLOCorrectionType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_update_request.go b/api/datadogV1/model_slo_correction_update_request.go index 08808a01659..88e69f60c64 100644 --- a/api/datadogV1/model_slo_correction_update_request.go +++ b/api/datadogV1/model_slo_correction_update_request.go @@ -86,8 +86,7 @@ func (o *SLOCorrectionUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *SLOCorrectionUpdateData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_correction_update_request_attributes.go b/api/datadogV1/model_slo_correction_update_request_attributes.go index 50f2336e100..30a48f9ed13 100644 --- a/api/datadogV1/model_slo_correction_update_request_attributes.go +++ b/api/datadogV1/model_slo_correction_update_request_attributes.go @@ -291,8 +291,7 @@ func (o *SLOCorrectionUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err Start *int64 `json:"start,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_creator.go b/api/datadogV1/model_slo_creator.go index b33938214f7..732ddf44876 100644 --- a/api/datadogV1/model_slo_creator.go +++ b/api/datadogV1/model_slo_creator.go @@ -165,8 +165,7 @@ func (o *SLOCreator) UnmarshalJSON(bytes []byte) (err error) { Id *int64 `json:"id,omitempty"` Name datadog.NullableString `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_delete_response.go b/api/datadogV1/model_slo_delete_response.go index 945fae3e7e8..4ccf7173d69 100644 --- a/api/datadogV1/model_slo_delete_response.go +++ b/api/datadogV1/model_slo_delete_response.go @@ -120,8 +120,7 @@ func (o *SLODeleteResponse) UnmarshalJSON(bytes []byte) (err error) { Data []string `json:"data,omitempty"` Errors map[string]string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_metrics.go b/api/datadogV1/model_slo_history_metrics.go index 4d64c0943be..d720928c5a7 100644 --- a/api/datadogV1/model_slo_history_metrics.go +++ b/api/datadogV1/model_slo_history_metrics.go @@ -277,59 +277,45 @@ func (o SLOHistoryMetrics) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Denominator *SLOHistoryMetricsSeries `json:"denominator"` Interval *int64 `json:"interval"` + Message *string `json:"message,omitempty"` Numerator *SLOHistoryMetricsSeries `json:"numerator"` Query *string `json:"query"` ResType *string `json:"res_type"` RespVersion *int64 `json:"resp_version"` Times *[]float64 `json:"times"` }{} - all := struct { - Denominator SLOHistoryMetricsSeries `json:"denominator"` - Interval int64 `json:"interval"` - Message *string `json:"message,omitempty"` - Numerator SLOHistoryMetricsSeries `json:"numerator"` - Query string `json:"query"` - ResType string `json:"res_type"` - RespVersion int64 `json:"resp_version"` - Times []float64 `json:"times"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Denominator == nil { + if all.Denominator == nil { return fmt.Errorf("required field denominator missing") } - if required.Interval == nil { + if all.Interval == nil { return fmt.Errorf("required field interval missing") } - if required.Numerator == nil { + if all.Numerator == nil { return fmt.Errorf("required field numerator missing") } - if required.Query == nil { + if all.Query == nil { return fmt.Errorf("required field query missing") } - if required.ResType == nil { + if all.ResType == nil { return fmt.Errorf("required field res_type missing") } - if required.RespVersion == nil { + if all.RespVersion == nil { return fmt.Errorf("required field resp_version missing") } - if required.Times == nil { + if all.Times == nil { return fmt.Errorf("required field times missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"denominator", "interval", "message", "numerator", "query", "res_type", "resp_version", "times"}) @@ -343,8 +329,8 @@ func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Denominator = all.Denominator - o.Interval = all.Interval + o.Denominator = *all.Denominator + o.Interval = *all.Interval o.Message = all.Message if all.Numerator.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -353,11 +339,11 @@ func (o *SLOHistoryMetrics) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Numerator = all.Numerator - o.Query = all.Query - o.ResType = all.ResType - o.RespVersion = all.RespVersion - o.Times = all.Times + o.Numerator = *all.Numerator + o.Query = *all.Query + o.ResType = *all.ResType + o.RespVersion = *all.RespVersion + o.Times = *all.Times if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_history_metrics_series.go b/api/datadogV1/model_slo_history_metrics_series.go index 009e57be4b5..8a554974e1d 100644 --- a/api/datadogV1/model_slo_history_metrics_series.go +++ b/api/datadogV1/model_slo_history_metrics_series.go @@ -166,32 +166,13 @@ func (o SLOHistoryMetricsSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Count *int64 `json:"count"` - Sum *float64 `json:"sum"` - Values *[]float64 `json:"values"` - }{} all := struct { - Count int64 `json:"count"` + Count *int64 `json:"count"` Metadata *SLOHistoryMetricsSeriesMetadata `json:"metadata,omitempty"` - Sum float64 `json:"sum"` - Values []float64 `json:"values"` + Sum *float64 `json:"sum"` + Values *[]float64 `json:"values"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Count == nil { - return fmt.Errorf("required field count missing") - } - if required.Sum == nil { - return fmt.Errorf("required field sum missing") - } - if required.Values == nil { - return fmt.Errorf("required field values missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -199,13 +180,22 @@ func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Count == nil { + return fmt.Errorf("required field count missing") + } + if all.Sum == nil { + return fmt.Errorf("required field sum missing") + } + if all.Values == nil { + return fmt.Errorf("required field values missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"count", "metadata", "sum", "values"}) } else { return err } - o.Count = all.Count + o.Count = *all.Count if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -214,8 +204,8 @@ func (o *SLOHistoryMetricsSeries) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.Sum = all.Sum - o.Values = all.Values + o.Sum = *all.Sum + o.Values = *all.Values if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_history_metrics_series_metadata.go b/api/datadogV1/model_slo_history_metrics_series_metadata.go index 076b2e573e7..2a349ddbeae 100644 --- a/api/datadogV1/model_slo_history_metrics_series_metadata.go +++ b/api/datadogV1/model_slo_history_metrics_series_metadata.go @@ -259,8 +259,7 @@ func (o *SLOHistoryMetricsSeriesMetadata) UnmarshalJSON(bytes []byte) (err error Scope *string `json:"scope,omitempty"` Unit []SLOHistoryMetricsSeriesMetadataUnit `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go b/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go index 7d4d0274856..8cd99c8f8fd 100644 --- a/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go +++ b/api/datadogV1/model_slo_history_metrics_series_metadata_unit.go @@ -278,8 +278,7 @@ func (o *SLOHistoryMetricsSeriesMetadataUnit) UnmarshalJSON(bytes []byte) (err e ScaleFactor *float64 `json:"scale_factor,omitempty"` ShortName datadog.NullableString `json:"short_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_monitor.go b/api/datadogV1/model_slo_history_monitor.go index 26af7cdd0a6..14afa14198e 100644 --- a/api/datadogV1/model_slo_history_monitor.go +++ b/api/datadogV1/model_slo_history_monitor.go @@ -481,8 +481,7 @@ func (o *SLOHistoryMonitor) UnmarshalJSON(bytes []byte) (err error) { SpanPrecision *float64 `json:"span_precision,omitempty"` Uptime *float64 `json:"uptime,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_response.go b/api/datadogV1/model_slo_history_response.go index db589577ef0..b2b1c10d5f0 100644 --- a/api/datadogV1/model_slo_history_response.go +++ b/api/datadogV1/model_slo_history_response.go @@ -121,8 +121,7 @@ func (o *SLOHistoryResponse) UnmarshalJSON(bytes []byte) (err error) { Data *SLOHistoryResponseData `json:"data,omitempty"` Errors []SLOHistoryResponseError `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_response_data.go b/api/datadogV1/model_slo_history_response_data.go index 98542980711..6d19b995fd2 100644 --- a/api/datadogV1/model_slo_history_response_data.go +++ b/api/datadogV1/model_slo_history_response_data.go @@ -403,8 +403,7 @@ func (o *SLOHistoryResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *SLOType `json:"type,omitempty"` TypeId *SLOTypeNumeric `json:"type_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_response_error.go b/api/datadogV1/model_slo_history_response_error.go index 3a3e1925020..989560b5784 100644 --- a/api/datadogV1/model_slo_history_response_error.go +++ b/api/datadogV1/model_slo_history_response_error.go @@ -86,8 +86,7 @@ func (o *SLOHistoryResponseError) UnmarshalJSON(bytes []byte) (err error) { all := struct { Error *string `json:"error,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_history_response_error_with_type.go b/api/datadogV1/model_slo_history_response_error_with_type.go index 272f4215849..ed43327ca61 100644 --- a/api/datadogV1/model_slo_history_response_error_with_type.go +++ b/api/datadogV1/model_slo_history_response_error_with_type.go @@ -105,26 +105,11 @@ func (o SLOHistoryResponseErrorWithType) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOHistoryResponseErrorWithType) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ErrorMessage *string `json:"error_message"` ErrorType *string `json:"error_type"` }{} - all := struct { - ErrorMessage string `json:"error_message"` - ErrorType string `json:"error_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ErrorMessage == nil { - return fmt.Errorf("required field error_message missing") - } - if required.ErrorType == nil { - return fmt.Errorf("required field error_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *SLOHistoryResponseErrorWithType) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.ErrorMessage == nil { + return fmt.Errorf("required field error_message missing") + } + if all.ErrorType == nil { + return fmt.Errorf("required field error_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"error_message", "error_type"}) } else { return err } - o.ErrorMessage = all.ErrorMessage - o.ErrorType = all.ErrorType + o.ErrorMessage = *all.ErrorMessage + o.ErrorType = *all.ErrorType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_history_sli_data.go b/api/datadogV1/model_slo_history_sli_data.go index 10dcd8cad01..1528a934406 100644 --- a/api/datadogV1/model_slo_history_sli_data.go +++ b/api/datadogV1/model_slo_history_sli_data.go @@ -488,8 +488,7 @@ func (o *SLOHistorySLIData) UnmarshalJSON(bytes []byte) (err error) { SpanPrecision *float64 `json:"span_precision,omitempty"` Uptime datadog.NullableFloat64 `json:"uptime,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_list_response.go b/api/datadogV1/model_slo_list_response.go index e2f36ebda70..2b095b3db2b 100644 --- a/api/datadogV1/model_slo_list_response.go +++ b/api/datadogV1/model_slo_list_response.go @@ -155,8 +155,7 @@ func (o *SLOListResponse) UnmarshalJSON(bytes []byte) (err error) { Errors []string `json:"errors,omitempty"` Metadata *SLOListResponseMetadata `json:"metadata,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_list_response_metadata.go b/api/datadogV1/model_slo_list_response_metadata.go index 95077de866b..cb65b067e46 100644 --- a/api/datadogV1/model_slo_list_response_metadata.go +++ b/api/datadogV1/model_slo_list_response_metadata.go @@ -86,8 +86,7 @@ func (o *SLOListResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *SLOListResponseMetadataPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_list_response_metadata_page.go b/api/datadogV1/model_slo_list_response_metadata_page.go index dc5fa84150a..7016a266c18 100644 --- a/api/datadogV1/model_slo_list_response_metadata_page.go +++ b/api/datadogV1/model_slo_list_response_metadata_page.go @@ -120,8 +120,7 @@ func (o *SLOListResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_list_widget_definition.go b/api/datadogV1/model_slo_list_widget_definition.go index ee012594624..7edae8e6a1b 100644 --- a/api/datadogV1/model_slo_list_widget_definition.go +++ b/api/datadogV1/model_slo_list_widget_definition.go @@ -206,29 +206,14 @@ func (o SLOListWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]SLOListWidgetRequest `json:"requests"` - Type *SLOListWidgetDefinitionType `json:"type"` - }{} all := struct { - Requests []SLOListWidgetRequest `json:"requests"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type SLOListWidgetDefinitionType `json:"type"` + Requests *[]SLOListWidgetRequest `json:"requests"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *SLOListWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -236,6 +221,12 @@ func (o *SLOListWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"requests", "title", "title_align", "title_size", "type"}) @@ -258,11 +249,11 @@ func (o *SLOListWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Requests = all.Requests + o.Requests = *all.Requests o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_list_widget_query.go b/api/datadogV1/model_slo_list_widget_query.go index 122a2f6e8cc..3e5d773ecb5 100644 --- a/api/datadogV1/model_slo_list_widget_query.go +++ b/api/datadogV1/model_slo_list_widget_query.go @@ -148,23 +148,12 @@ func (o SLOListWidgetQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListWidgetQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - QueryString *string `json:"query_string"` - }{} all := struct { Limit *int64 `json:"limit,omitempty"` - QueryString string `json:"query_string"` + QueryString *string `json:"query_string"` Sort []WidgetFieldSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.QueryString == nil { - return fmt.Errorf("required field query_string missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -172,6 +161,9 @@ func (o *SLOListWidgetQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.QueryString == nil { + return fmt.Errorf("required field query_string missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"limit", "query_string", "sort"}) @@ -179,7 +171,7 @@ func (o *SLOListWidgetQuery) UnmarshalJSON(bytes []byte) (err error) { return err } o.Limit = all.Limit - o.QueryString = all.QueryString + o.QueryString = *all.QueryString o.Sort = all.Sort if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_slo_list_widget_request.go b/api/datadogV1/model_slo_list_widget_request.go index 7cc2992b8b4..9defd45010a 100644 --- a/api/datadogV1/model_slo_list_widget_request.go +++ b/api/datadogV1/model_slo_list_widget_request.go @@ -105,26 +105,11 @@ func (o SLOListWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOListWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Query *SLOListWidgetQuery `json:"query"` RequestType *SLOListWidgetRequestType `json:"request_type"` }{} - all := struct { - Query SLOListWidgetQuery `json:"query"` - RequestType SLOListWidgetRequestType `json:"request_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - if required.RequestType == nil { - return fmt.Errorf("required field request_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SLOListWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + if all.RequestType == nil { + return fmt.Errorf("required field request_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"query", "request_type"}) @@ -153,8 +144,8 @@ func (o *SLOListWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Query = all.Query - o.RequestType = all.RequestType + o.Query = *all.Query + o.RequestType = *all.RequestType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_slo_overall_statuses.go b/api/datadogV1/model_slo_overall_statuses.go index 2ecb64ea27b..1f92c3b8720 100644 --- a/api/datadogV1/model_slo_overall_statuses.go +++ b/api/datadogV1/model_slo_overall_statuses.go @@ -414,8 +414,7 @@ func (o *SLOOverallStatuses) UnmarshalJSON(bytes []byte) (err error) { Target *float64 `json:"target,omitempty"` Timeframe *SLOTimeframe `json:"timeframe,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_raw_error_budget_remaining.go b/api/datadogV1/model_slo_raw_error_budget_remaining.go index 5d43fd2b975..6b68b8b12fb 100644 --- a/api/datadogV1/model_slo_raw_error_budget_remaining.go +++ b/api/datadogV1/model_slo_raw_error_budget_remaining.go @@ -120,8 +120,7 @@ func (o *SLORawErrorBudgetRemaining) UnmarshalJSON(bytes []byte) (err error) { Unit *string `json:"unit,omitempty"` Value *float64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_response.go b/api/datadogV1/model_slo_response.go index 27c77cb9e11..18fddc88031 100644 --- a/api/datadogV1/model_slo_response.go +++ b/api/datadogV1/model_slo_response.go @@ -122,8 +122,7 @@ func (o *SLOResponse) UnmarshalJSON(bytes []byte) (err error) { Data *SLOResponseData `json:"data,omitempty"` Errors []string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_response_data.go b/api/datadogV1/model_slo_response_data.go index 0e595ca89cd..0104b2e8f67 100644 --- a/api/datadogV1/model_slo_response_data.go +++ b/api/datadogV1/model_slo_response_data.go @@ -670,8 +670,7 @@ func (o *SLOResponseData) UnmarshalJSON(bytes []byte) (err error) { Type *SLOType `json:"type,omitempty"` WarningThreshold *float64 `json:"warning_threshold,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_status.go b/api/datadogV1/model_slo_status.go index 3e9fddb04a6..b63cb9037b8 100644 --- a/api/datadogV1/model_slo_status.go +++ b/api/datadogV1/model_slo_status.go @@ -346,8 +346,7 @@ func (o *SLOStatus) UnmarshalJSON(bytes []byte) (err error) { SpanPrecision datadog.NullableInt64 `json:"span_precision,omitempty"` State *SLOState `json:"state,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_slo_threshold.go b/api/datadogV1/model_slo_threshold.go index e176ec254cd..92af8639332 100644 --- a/api/datadogV1/model_slo_threshold.go +++ b/api/datadogV1/model_slo_threshold.go @@ -213,29 +213,14 @@ func (o SLOThreshold) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Target *float64 `json:"target"` - Timeframe *SLOTimeframe `json:"timeframe"` - }{} all := struct { - Target float64 `json:"target"` - TargetDisplay *string `json:"target_display,omitempty"` - Timeframe SLOTimeframe `json:"timeframe"` - Warning *float64 `json:"warning,omitempty"` - WarningDisplay *string `json:"warning_display,omitempty"` + Target *float64 `json:"target"` + TargetDisplay *string `json:"target_display,omitempty"` + Timeframe *SLOTimeframe `json:"timeframe"` + Warning *float64 `json:"warning,omitempty"` + WarningDisplay *string `json:"warning_display,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Timeframe == nil { - return fmt.Errorf("required field timeframe missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -243,6 +228,12 @@ func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Timeframe == nil { + return fmt.Errorf("required field timeframe missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"target", "target_display", "timeframe", "warning", "warning_display"}) @@ -257,9 +248,9 @@ func (o *SLOThreshold) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Target = all.Target + o.Target = *all.Target o.TargetDisplay = all.TargetDisplay - o.Timeframe = all.Timeframe + o.Timeframe = *all.Timeframe o.Warning = all.Warning o.WarningDisplay = all.WarningDisplay if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_slo_widget_definition.go b/api/datadogV1/model_slo_widget_definition.go index 7401f88d72b..0adbce34b07 100644 --- a/api/datadogV1/model_slo_widget_definition.go +++ b/api/datadogV1/model_slo_widget_definition.go @@ -406,35 +406,20 @@ func (o SLOWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SLOWidgetDefinitionType `json:"type"` - ViewType *string `json:"view_type"` - }{} all := struct { - AdditionalQueryFilters *string `json:"additional_query_filters,omitempty"` - GlobalTimeTarget *string `json:"global_time_target,omitempty"` - ShowErrorBudget *bool `json:"show_error_budget,omitempty"` - SloId *string `json:"slo_id,omitempty"` - TimeWindows []WidgetTimeWindows `json:"time_windows,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type SLOWidgetDefinitionType `json:"type"` - ViewMode *WidgetViewMode `json:"view_mode,omitempty"` - ViewType string `json:"view_type"` + AdditionalQueryFilters *string `json:"additional_query_filters,omitempty"` + GlobalTimeTarget *string `json:"global_time_target,omitempty"` + ShowErrorBudget *bool `json:"show_error_budget,omitempty"` + SloId *string `json:"slo_id,omitempty"` + TimeWindows []WidgetTimeWindows `json:"time_windows,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *SLOWidgetDefinitionType `json:"type"` + ViewMode *WidgetViewMode `json:"view_mode,omitempty"` + ViewType *string `json:"view_type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.ViewType == nil { - return fmt.Errorf("required field view_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -442,6 +427,12 @@ func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.ViewType == nil { + return fmt.Errorf("required field view_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"additional_query_filters", "global_time_target", "show_error_budget", "slo_id", "time_windows", "title", "title_align", "title_size", "type", "view_mode", "view_type"}) @@ -480,9 +471,9 @@ func (o *SLOWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type o.ViewMode = all.ViewMode - o.ViewType = all.ViewType + o.ViewType = *all.ViewType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_successful_signal_update_response.go b/api/datadogV1/model_successful_signal_update_response.go index 3e660d78964..c413694cf4f 100644 --- a/api/datadogV1/model_successful_signal_update_response.go +++ b/api/datadogV1/model_successful_signal_update_response.go @@ -86,8 +86,7 @@ func (o *SuccessfulSignalUpdateResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Status *string `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_sunburst_widget_definition.go b/api/datadogV1/model_sunburst_widget_definition.go index a6bbe6833e7..9334fd4494a 100644 --- a/api/datadogV1/model_sunburst_widget_definition.go +++ b/api/datadogV1/model_sunburst_widget_definition.go @@ -338,33 +338,18 @@ func (o SunburstWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]SunburstWidgetRequest `json:"requests"` - Type *SunburstWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - HideTotal *bool `json:"hide_total,omitempty"` - Legend *SunburstWidgetLegend `json:"legend,omitempty"` - Requests []SunburstWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type SunburstWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + HideTotal *bool `json:"hide_total,omitempty"` + Legend *SunburstWidgetLegend `json:"legend,omitempty"` + Requests *[]SunburstWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *SunburstWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -372,6 +357,12 @@ func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "hide_total", "legend", "requests", "time", "title", "title_align", "title_size", "type"}) @@ -397,7 +388,7 @@ func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.CustomLinks = all.CustomLinks o.HideTotal = all.HideTotal o.Legend = all.Legend - o.Requests = all.Requests + o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -409,7 +400,7 @@ func (o *SunburstWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go b/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go index 2efa6d31fd1..43372e27a65 100644 --- a/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go +++ b/api/datadogV1/model_sunburst_widget_legend_inline_automatic.go @@ -144,23 +144,12 @@ func (o SunburstWidgetLegendInlineAutomatic) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SunburstWidgetLegendInlineAutomaticType `json:"type"` - }{} all := struct { - HidePercent *bool `json:"hide_percent,omitempty"` - HideValue *bool `json:"hide_value,omitempty"` - Type SunburstWidgetLegendInlineAutomaticType `json:"type"` + HidePercent *bool `json:"hide_percent,omitempty"` + HideValue *bool `json:"hide_value,omitempty"` + Type *SunburstWidgetLegendInlineAutomaticType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"hide_percent", "hide_value", "type"}) @@ -184,7 +176,7 @@ func (o *SunburstWidgetLegendInlineAutomatic) UnmarshalJSON(bytes []byte) (err e } o.HidePercent = all.HidePercent o.HideValue = all.HideValue - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_sunburst_widget_legend_table.go b/api/datadogV1/model_sunburst_widget_legend_table.go index 687c14f906d..0d499c52c69 100644 --- a/api/datadogV1/model_sunburst_widget_legend_table.go +++ b/api/datadogV1/model_sunburst_widget_legend_table.go @@ -78,21 +78,10 @@ func (o SunburstWidgetLegendTable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SunburstWidgetLegendTableType `json:"type"` - }{} all := struct { - Type SunburstWidgetLegendTableType `json:"type"` + Type *SunburstWidgetLegendTableType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"type"}) @@ -114,7 +106,7 @@ func (o *SunburstWidgetLegendTable) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_sunburst_widget_request.go b/api/datadogV1/model_sunburst_widget_request.go index 8a736d1b5c0..c20f9bb36af 100644 --- a/api/datadogV1/model_sunburst_widget_request.go +++ b/api/datadogV1/model_sunburst_widget_request.go @@ -494,8 +494,7 @@ func (o *SunburstWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_api_step.go b/api/datadogV1/model_synthetics_api_step.go index 7675079c680..225d93e50a5 100644 --- a/api/datadogV1/model_synthetics_api_step.go +++ b/api/datadogV1/model_synthetics_api_step.go @@ -292,47 +292,36 @@ func (o SyntheticsAPIStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Assertions *[]SyntheticsAssertion `json:"assertions"` - Name *string `json:"name"` - Request *SyntheticsTestRequest `json:"request"` - Subtype *SyntheticsAPIStepSubtype `json:"subtype"` - }{} all := struct { AllowFailure *bool `json:"allowFailure,omitempty"` - Assertions []SyntheticsAssertion `json:"assertions"` + Assertions *[]SyntheticsAssertion `json:"assertions"` ExtractedValues []SyntheticsParsingOptions `json:"extractedValues,omitempty"` IsCritical *bool `json:"isCritical,omitempty"` - Name string `json:"name"` - Request SyntheticsTestRequest `json:"request"` + Name *string `json:"name"` + Request *SyntheticsTestRequest `json:"request"` Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` - Subtype SyntheticsAPIStepSubtype `json:"subtype"` + Subtype *SyntheticsAPIStepSubtype `json:"subtype"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Assertions == nil { + if all.Assertions == nil { return fmt.Errorf("required field assertions missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Request == nil { + if all.Request == nil { return fmt.Errorf("required field request missing") } - if required.Subtype == nil { + if all.Subtype == nil { return fmt.Errorf("required field subtype missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"allowFailure", "assertions", "extractedValues", "isCritical", "name", "request", "retry", "subtype"}) @@ -348,10 +337,10 @@ func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { return nil } o.AllowFailure = all.AllowFailure - o.Assertions = all.Assertions + o.Assertions = *all.Assertions o.ExtractedValues = all.ExtractedValues o.IsCritical = all.IsCritical - o.Name = all.Name + o.Name = *all.Name if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -359,7 +348,7 @@ func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Request = all.Request + o.Request = *all.Request if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -368,7 +357,7 @@ func (o *SyntheticsAPIStep) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Retry = all.Retry - o.Subtype = all.Subtype + o.Subtype = *all.Subtype if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_api_test_.go b/api/datadogV1/model_synthetics_api_test_.go index 8aa86dbe156..4993f95f2d8 100644 --- a/api/datadogV1/model_synthetics_api_test_.go +++ b/api/datadogV1/model_synthetics_api_test_.go @@ -382,58 +382,45 @@ func (o SyntheticsAPITest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Config *SyntheticsAPITestConfig `json:"config"` - Locations *[]string `json:"locations"` - Message *string `json:"message"` - Name *string `json:"name"` - Options *SyntheticsTestOptions `json:"options"` - Type *SyntheticsAPITestType `json:"type"` - }{} all := struct { - Config SyntheticsAPITestConfig `json:"config"` - Locations []string `json:"locations"` - Message string `json:"message"` + Config *SyntheticsAPITestConfig `json:"config"` + Locations *[]string `json:"locations"` + Message *string `json:"message"` MonitorId *int64 `json:"monitor_id,omitempty"` - Name string `json:"name"` - Options SyntheticsTestOptions `json:"options"` + Name *string `json:"name"` + Options *SyntheticsTestOptions `json:"options"` PublicId *string `json:"public_id,omitempty"` Status *SyntheticsTestPauseStatus `json:"status,omitempty"` Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` Tags []string `json:"tags,omitempty"` - Type SyntheticsAPITestType `json:"type"` + Type *SyntheticsAPITestType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Config == nil { + if all.Config == nil { return fmt.Errorf("required field config missing") } - if required.Locations == nil { + if all.Locations == nil { return fmt.Errorf("required field locations missing") } - if required.Message == nil { + if all.Message == nil { return fmt.Errorf("required field message missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Options == nil { + if all.Options == nil { return fmt.Errorf("required field options missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"config", "locations", "message", "monitor_id", "name", "options", "public_id", "status", "subtype", "tags", "type"}) @@ -471,11 +458,11 @@ func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Config = all.Config - o.Locations = all.Locations - o.Message = all.Message + o.Config = *all.Config + o.Locations = *all.Locations + o.Message = *all.Message o.MonitorId = all.MonitorId - o.Name = all.Name + o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -483,12 +470,12 @@ func (o *SyntheticsAPITest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Options = all.Options + o.Options = *all.Options o.PublicId = all.PublicId o.Status = all.Status o.Subtype = all.Subtype o.Tags = all.Tags - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_api_test_config.go b/api/datadogV1/model_synthetics_api_test_config.go index 6a5ca187504..78772b11132 100644 --- a/api/datadogV1/model_synthetics_api_test_config.go +++ b/api/datadogV1/model_synthetics_api_test_config.go @@ -188,8 +188,7 @@ func (o *SyntheticsAPITestConfig) UnmarshalJSON(bytes []byte) (err error) { Request *SyntheticsTestRequest `json:"request,omitempty"` Steps []SyntheticsAPIStep `json:"steps,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_api_test_result_data.go b/api/datadogV1/model_synthetics_api_test_result_data.go index a0e75c5b7b9..fa4c97a66e3 100644 --- a/api/datadogV1/model_synthetics_api_test_result_data.go +++ b/api/datadogV1/model_synthetics_api_test_result_data.go @@ -359,8 +359,7 @@ func (o *SyntheticsAPITestResultData) UnmarshalJSON(bytes []byte) (err error) { ResponseSize *int64 `json:"responseSize,omitempty"` Timings *SyntheticsTiming `json:"timings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_api_test_result_failure.go b/api/datadogV1/model_synthetics_api_test_result_failure.go index 7027f5f6efc..ca0c1ebd3a2 100644 --- a/api/datadogV1/model_synthetics_api_test_result_failure.go +++ b/api/datadogV1/model_synthetics_api_test_result_failure.go @@ -120,8 +120,7 @@ func (o *SyntheticsApiTestResultFailure) UnmarshalJSON(bytes []byte) (err error) Code *SyntheticsApiTestFailureCode `json:"code,omitempty"` Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_api_test_result_full.go b/api/datadogV1/model_synthetics_api_test_result_full.go index 2260536ad45..036fada7c2e 100644 --- a/api/datadogV1/model_synthetics_api_test_result_full.go +++ b/api/datadogV1/model_synthetics_api_test_result_full.go @@ -293,8 +293,7 @@ func (o *SyntheticsAPITestResultFull) UnmarshalJSON(bytes []byte) (err error) { ResultId *string `json:"result_id,omitempty"` Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_api_test_result_full_check.go b/api/datadogV1/model_synthetics_api_test_result_full_check.go index caf21a8872b..f71e695c19a 100644 --- a/api/datadogV1/model_synthetics_api_test_result_full_check.go +++ b/api/datadogV1/model_synthetics_api_test_result_full_check.go @@ -78,21 +78,10 @@ func (o SyntheticsAPITestResultFullCheck) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Config *SyntheticsTestConfig `json:"config"` - }{} all := struct { - Config SyntheticsTestConfig `json:"config"` + Config *SyntheticsTestConfig `json:"config"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Config == nil { - return fmt.Errorf("required field config missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Config == nil { + return fmt.Errorf("required field config missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"config"}) @@ -113,7 +105,7 @@ func (o *SyntheticsAPITestResultFullCheck) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Config = all.Config + o.Config = *all.Config if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_api_test_result_short.go b/api/datadogV1/model_synthetics_api_test_result_short.go index 1d3bdeb3b1a..6e8282a7e7a 100644 --- a/api/datadogV1/model_synthetics_api_test_result_short.go +++ b/api/datadogV1/model_synthetics_api_test_result_short.go @@ -225,8 +225,7 @@ func (o *SyntheticsAPITestResultShort) UnmarshalJSON(bytes []byte) (err error) { ResultId *string `json:"result_id,omitempty"` Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_api_test_result_short_result.go b/api/datadogV1/model_synthetics_api_test_result_short_result.go index 8cbf64c973f..4fd4ed47bb6 100644 --- a/api/datadogV1/model_synthetics_api_test_result_short_result.go +++ b/api/datadogV1/model_synthetics_api_test_result_short_result.go @@ -121,8 +121,7 @@ func (o *SyntheticsAPITestResultShortResult) UnmarshalJSON(bytes []byte) (err er Passed *bool `json:"passed,omitempty"` Timings *SyntheticsTiming `json:"timings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_assertion_json_path_target.go b/api/datadogV1/model_synthetics_assertion_json_path_target.go index 6f601a2c293..77af422fc55 100644 --- a/api/datadogV1/model_synthetics_assertion_json_path_target.go +++ b/api/datadogV1/model_synthetics_assertion_json_path_target.go @@ -171,28 +171,13 @@ func (o SyntheticsAssertionJSONPathTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Operator *SyntheticsAssertionJSONPathOperator `json:"operator"` - Type *SyntheticsAssertionType `json:"type"` - }{} all := struct { - Operator SyntheticsAssertionJSONPathOperator `json:"operator"` + Operator *SyntheticsAssertionJSONPathOperator `json:"operator"` Property *string `json:"property,omitempty"` Target *SyntheticsAssertionJSONPathTargetTarget `json:"target,omitempty"` - Type SyntheticsAssertionType `json:"type"` + Type *SyntheticsAssertionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Operator == nil { - return fmt.Errorf("required field operator missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +185,12 @@ func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.Operator == nil { + return fmt.Errorf("required field operator missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"operator", "property", "target", "type"}) @@ -222,7 +213,7 @@ func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } - o.Operator = all.Operator + o.Operator = *all.Operator o.Property = all.Property if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -232,7 +223,7 @@ func (o *SyntheticsAssertionJSONPathTarget) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw } o.Target = all.Target - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_assertion_json_path_target_target.go b/api/datadogV1/model_synthetics_assertion_json_path_target_target.go index eb21eb81b35..c79f6c0c038 100644 --- a/api/datadogV1/model_synthetics_assertion_json_path_target_target.go +++ b/api/datadogV1/model_synthetics_assertion_json_path_target_target.go @@ -154,8 +154,7 @@ func (o *SyntheticsAssertionJSONPathTargetTarget) UnmarshalJSON(bytes []byte) (e Operator *string `json:"operator,omitempty"` TargetValue interface{} `json:"targetValue,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_assertion_target.go b/api/datadogV1/model_synthetics_assertion_target.go index acb8d03ac07..c5186c8fc0a 100644 --- a/api/datadogV1/model_synthetics_assertion_target.go +++ b/api/datadogV1/model_synthetics_assertion_target.go @@ -165,32 +165,13 @@ func (o SyntheticsAssertionTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Operator *SyntheticsAssertionOperator `json:"operator"` + Property *string `json:"property,omitempty"` Target *interface{} `json:"target"` Type *SyntheticsAssertionType `json:"type"` }{} - all := struct { - Operator SyntheticsAssertionOperator `json:"operator"` - Property *string `json:"property,omitempty"` - Target interface{} `json:"target"` - Type SyntheticsAssertionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Operator == nil { - return fmt.Errorf("required field operator missing") - } - if required.Target == nil { - return fmt.Errorf("required field target missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,6 +179,15 @@ func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Operator == nil { + return fmt.Errorf("required field operator missing") + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"operator", "property", "target", "type"}) @@ -220,10 +210,10 @@ func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Operator = all.Operator + o.Operator = *all.Operator o.Property = all.Property - o.Target = all.Target - o.Type = all.Type + o.Target = *all.Target + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_assertion_x_path_target.go b/api/datadogV1/model_synthetics_assertion_x_path_target.go index ed1d6d4262d..fdc50aa28fb 100644 --- a/api/datadogV1/model_synthetics_assertion_x_path_target.go +++ b/api/datadogV1/model_synthetics_assertion_x_path_target.go @@ -171,28 +171,13 @@ func (o SyntheticsAssertionXPathTarget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Operator *SyntheticsAssertionXPathOperator `json:"operator"` - Type *SyntheticsAssertionType `json:"type"` - }{} all := struct { - Operator SyntheticsAssertionXPathOperator `json:"operator"` + Operator *SyntheticsAssertionXPathOperator `json:"operator"` Property *string `json:"property,omitempty"` Target *SyntheticsAssertionXPathTargetTarget `json:"target,omitempty"` - Type SyntheticsAssertionType `json:"type"` + Type *SyntheticsAssertionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Operator == nil { - return fmt.Errorf("required field operator missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +185,12 @@ func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Operator == nil { + return fmt.Errorf("required field operator missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"operator", "property", "target", "type"}) @@ -222,7 +213,7 @@ func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Operator = all.Operator + o.Operator = *all.Operator o.Property = all.Property if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -232,7 +223,7 @@ func (o *SyntheticsAssertionXPathTarget) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw } o.Target = all.Target - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_assertion_x_path_target_target.go b/api/datadogV1/model_synthetics_assertion_x_path_target_target.go index 9458abd0705..de05855ea42 100644 --- a/api/datadogV1/model_synthetics_assertion_x_path_target_target.go +++ b/api/datadogV1/model_synthetics_assertion_x_path_target_target.go @@ -154,8 +154,7 @@ func (o *SyntheticsAssertionXPathTargetTarget) UnmarshalJSON(bytes []byte) (err TargetValue interface{} `json:"targetValue,omitempty"` XPath *string `json:"xPath,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_basic_auth_digest.go b/api/datadogV1/model_synthetics_basic_auth_digest.go index d5c71d3e1d0..ec25aa4a052 100644 --- a/api/datadogV1/model_synthetics_basic_auth_digest.go +++ b/api/datadogV1/model_synthetics_basic_auth_digest.go @@ -142,27 +142,12 @@ func (o SyntheticsBasicAuthDigest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Password *string `json:"password"` - Username *string `json:"username"` - }{} all := struct { - Password string `json:"password"` + Password *string `json:"password"` Type *SyntheticsBasicAuthDigestType `json:"type,omitempty"` - Username string `json:"username"` + Username *string `json:"username"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Password == nil { - return fmt.Errorf("required field password missing") - } - if required.Username == nil { - return fmt.Errorf("required field username missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +155,12 @@ func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Password == nil { + return fmt.Errorf("required field password missing") + } + if all.Username == nil { + return fmt.Errorf("required field username missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"password", "type", "username"}) @@ -184,9 +175,9 @@ func (o *SyntheticsBasicAuthDigest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Password = all.Password + o.Password = *all.Password o.Type = all.Type - o.Username = all.Username + o.Username = *all.Username if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_basic_auth_ntlm.go b/api/datadogV1/model_synthetics_basic_auth_ntlm.go index 752353d365d..950aaf42320 100644 --- a/api/datadogV1/model_synthetics_basic_auth_ntlm.go +++ b/api/datadogV1/model_synthetics_basic_auth_ntlm.go @@ -212,25 +212,14 @@ func (o SyntheticsBasicAuthNTLM) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SyntheticsBasicAuthNTLMType `json:"type"` - }{} all := struct { - Domain *string `json:"domain,omitempty"` - Password *string `json:"password,omitempty"` - Type SyntheticsBasicAuthNTLMType `json:"type"` - Username *string `json:"username,omitempty"` - Workstation *string `json:"workstation,omitempty"` + Domain *string `json:"domain,omitempty"` + Password *string `json:"password,omitempty"` + Type *SyntheticsBasicAuthNTLMType `json:"type"` + Username *string `json:"username,omitempty"` + Workstation *string `json:"workstation,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -238,6 +227,9 @@ func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"domain", "password", "type", "username", "workstation"}) @@ -254,7 +246,7 @@ func (o *SyntheticsBasicAuthNTLM) UnmarshalJSON(bytes []byte) (err error) { } o.Domain = all.Domain o.Password = all.Password - o.Type = all.Type + o.Type = *all.Type o.Username = all.Username o.Workstation = all.Workstation if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_basic_auth_oauth_client.go b/api/datadogV1/model_synthetics_basic_auth_oauth_client.go index 09d197ba22a..cd0ce140a03 100644 --- a/api/datadogV1/model_synthetics_basic_auth_oauth_client.go +++ b/api/datadogV1/model_synthetics_basic_auth_oauth_client.go @@ -295,47 +295,36 @@ func (o SyntheticsBasicAuthOauthClient) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthOauthClient) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { AccessTokenUrl *string `json:"accessTokenUrl"` + Audience *string `json:"audience,omitempty"` ClientId *string `json:"clientId"` ClientSecret *string `json:"clientSecret"` + Resource *string `json:"resource,omitempty"` + Scope *string `json:"scope,omitempty"` TokenApiAuthentication *SyntheticsBasicAuthOauthTokenApiAuthentication `json:"tokenApiAuthentication"` + Type *SyntheticsBasicAuthOauthClientType `json:"type,omitempty"` }{} - all := struct { - AccessTokenUrl string `json:"accessTokenUrl"` - Audience *string `json:"audience,omitempty"` - ClientId string `json:"clientId"` - ClientSecret string `json:"clientSecret"` - Resource *string `json:"resource,omitempty"` - Scope *string `json:"scope,omitempty"` - TokenApiAuthentication SyntheticsBasicAuthOauthTokenApiAuthentication `json:"tokenApiAuthentication"` - Type *SyntheticsBasicAuthOauthClientType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.AccessTokenUrl == nil { + if all.AccessTokenUrl == nil { return fmt.Errorf("required field accessTokenUrl missing") } - if required.ClientId == nil { + if all.ClientId == nil { return fmt.Errorf("required field clientId missing") } - if required.ClientSecret == nil { + if all.ClientSecret == nil { return fmt.Errorf("required field clientSecret missing") } - if required.TokenApiAuthentication == nil { + if all.TokenApiAuthentication == nil { return fmt.Errorf("required field tokenApiAuthentication missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"accessTokenUrl", "audience", "clientId", "clientSecret", "resource", "scope", "tokenApiAuthentication", "type"}) @@ -358,13 +347,13 @@ func (o *SyntheticsBasicAuthOauthClient) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.AccessTokenUrl = all.AccessTokenUrl + o.AccessTokenUrl = *all.AccessTokenUrl o.Audience = all.Audience - o.ClientId = all.ClientId - o.ClientSecret = all.ClientSecret + o.ClientId = *all.ClientId + o.ClientSecret = *all.ClientSecret o.Resource = all.Resource o.Scope = all.Scope - o.TokenApiAuthentication = all.TokenApiAuthentication + o.TokenApiAuthentication = *all.TokenApiAuthentication o.Type = all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go b/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go index 7c788d6e72c..6b9ad9a40ac 100644 --- a/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go +++ b/api/datadogV1/model_synthetics_basic_auth_oauth_rop.go @@ -361,49 +361,38 @@ func (o SyntheticsBasicAuthOauthROP) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthOauthROP) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { AccessTokenUrl *string `json:"accessTokenUrl"` + Audience *string `json:"audience,omitempty"` + ClientId *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` Password *string `json:"password"` + Resource *string `json:"resource,omitempty"` + Scope *string `json:"scope,omitempty"` TokenApiAuthentication *SyntheticsBasicAuthOauthTokenApiAuthentication `json:"tokenApiAuthentication"` + Type *SyntheticsBasicAuthOauthROPType `json:"type,omitempty"` Username *string `json:"username"` }{} - all := struct { - AccessTokenUrl string `json:"accessTokenUrl"` - Audience *string `json:"audience,omitempty"` - ClientId *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - Password string `json:"password"` - Resource *string `json:"resource,omitempty"` - Scope *string `json:"scope,omitempty"` - TokenApiAuthentication SyntheticsBasicAuthOauthTokenApiAuthentication `json:"tokenApiAuthentication"` - Type *SyntheticsBasicAuthOauthROPType `json:"type,omitempty"` - Username string `json:"username"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.AccessTokenUrl == nil { + if all.AccessTokenUrl == nil { return fmt.Errorf("required field accessTokenUrl missing") } - if required.Password == nil { + if all.Password == nil { return fmt.Errorf("required field password missing") } - if required.TokenApiAuthentication == nil { + if all.TokenApiAuthentication == nil { return fmt.Errorf("required field tokenApiAuthentication missing") } - if required.Username == nil { + if all.Username == nil { return fmt.Errorf("required field username missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"accessTokenUrl", "audience", "clientId", "clientSecret", "password", "resource", "scope", "tokenApiAuthentication", "type", "username"}) @@ -426,16 +415,16 @@ func (o *SyntheticsBasicAuthOauthROP) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.AccessTokenUrl = all.AccessTokenUrl + o.AccessTokenUrl = *all.AccessTokenUrl o.Audience = all.Audience o.ClientId = all.ClientId o.ClientSecret = all.ClientSecret - o.Password = all.Password + o.Password = *all.Password o.Resource = all.Resource o.Scope = all.Scope - o.TokenApiAuthentication = all.TokenApiAuthentication + o.TokenApiAuthentication = *all.TokenApiAuthentication o.Type = all.Type - o.Username = all.Username + o.Username = *all.Username if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_basic_auth_sigv4.go b/api/datadogV1/model_synthetics_basic_auth_sigv4.go index 3a55de67e06..c16af5bda5a 100644 --- a/api/datadogV1/model_synthetics_basic_auth_sigv4.go +++ b/api/datadogV1/model_synthetics_basic_auth_sigv4.go @@ -233,34 +233,15 @@ func (o SyntheticsBasicAuthSigv4) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - AccessKey *string `json:"accessKey"` - SecretKey *string `json:"secretKey"` - Type *SyntheticsBasicAuthSigv4Type `json:"type"` - }{} all := struct { - AccessKey string `json:"accessKey"` - Region *string `json:"region,omitempty"` - SecretKey string `json:"secretKey"` - ServiceName *string `json:"serviceName,omitempty"` - SessionToken *string `json:"sessionToken,omitempty"` - Type SyntheticsBasicAuthSigv4Type `json:"type"` + AccessKey *string `json:"accessKey"` + Region *string `json:"region,omitempty"` + SecretKey *string `json:"secretKey"` + ServiceName *string `json:"serviceName,omitempty"` + SessionToken *string `json:"sessionToken,omitempty"` + Type *SyntheticsBasicAuthSigv4Type `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccessKey == nil { - return fmt.Errorf("required field accessKey missing") - } - if required.SecretKey == nil { - return fmt.Errorf("required field secretKey missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -268,6 +249,15 @@ func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AccessKey == nil { + return fmt.Errorf("required field accessKey missing") + } + if all.SecretKey == nil { + return fmt.Errorf("required field secretKey missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"accessKey", "region", "secretKey", "serviceName", "sessionToken", "type"}) @@ -282,12 +272,12 @@ func (o *SyntheticsBasicAuthSigv4) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.AccessKey = all.AccessKey + o.AccessKey = *all.AccessKey o.Region = all.Region - o.SecretKey = all.SecretKey + o.SecretKey = *all.SecretKey o.ServiceName = all.ServiceName o.SessionToken = all.SessionToken - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_basic_auth_web.go b/api/datadogV1/model_synthetics_basic_auth_web.go index 0b10a7f1e20..0e253af81ba 100644 --- a/api/datadogV1/model_synthetics_basic_auth_web.go +++ b/api/datadogV1/model_synthetics_basic_auth_web.go @@ -142,27 +142,12 @@ func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Password *string `json:"password"` - Username *string `json:"username"` - }{} all := struct { - Password string `json:"password"` + Password *string `json:"password"` Type *SyntheticsBasicAuthWebType `json:"type,omitempty"` - Username string `json:"username"` + Username *string `json:"username"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Password == nil { - return fmt.Errorf("required field password missing") - } - if required.Username == nil { - return fmt.Errorf("required field username missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +155,12 @@ func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Password == nil { + return fmt.Errorf("required field password missing") + } + if all.Username == nil { + return fmt.Errorf("required field username missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"password", "type", "username"}) @@ -184,9 +175,9 @@ func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Password = all.Password + o.Password = *all.Password o.Type = all.Type - o.Username = all.Username + o.Username = *all.Username if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_batch_details.go b/api/datadogV1/model_synthetics_batch_details.go index a82644dec46..9a16efccc72 100644 --- a/api/datadogV1/model_synthetics_batch_details.go +++ b/api/datadogV1/model_synthetics_batch_details.go @@ -86,8 +86,7 @@ func (o *SyntheticsBatchDetails) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *SyntheticsBatchDetailsData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_batch_details_data.go b/api/datadogV1/model_synthetics_batch_details_data.go index 7abbb65b468..e98874db106 100644 --- a/api/datadogV1/model_synthetics_batch_details_data.go +++ b/api/datadogV1/model_synthetics_batch_details_data.go @@ -154,8 +154,7 @@ func (o *SyntheticsBatchDetailsData) UnmarshalJSON(bytes []byte) (err error) { Results []SyntheticsBatchResult `json:"results,omitempty"` Status *SyntheticsStatus `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_batch_result.go b/api/datadogV1/model_synthetics_batch_result.go index 30929d99aa3..0439d18efc8 100644 --- a/api/datadogV1/model_synthetics_batch_result.go +++ b/api/datadogV1/model_synthetics_batch_result.go @@ -392,8 +392,7 @@ func (o *SyntheticsBatchResult) UnmarshalJSON(bytes []byte) (err error) { TestPublicId *string `json:"test_public_id,omitempty"` TestType *SyntheticsTestDetailsType `json:"test_type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_browser_error.go b/api/datadogV1/model_synthetics_browser_error.go index 2d3a1c87e6f..43936a270a7 100644 --- a/api/datadogV1/model_synthetics_browser_error.go +++ b/api/datadogV1/model_synthetics_browser_error.go @@ -165,32 +165,13 @@ func (o SyntheticsBrowserError) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Description *string `json:"description"` Name *string `json:"name"` + Status *int64 `json:"status,omitempty"` Type *SyntheticsBrowserErrorType `json:"type"` }{} - all := struct { - Description string `json:"description"` - Name string `json:"name"` - Status *int64 `json:"status,omitempty"` - Type SyntheticsBrowserErrorType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Description == nil { - return fmt.Errorf("required field description missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,6 +179,15 @@ func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "status", "type"}) @@ -212,10 +202,10 @@ func (o *SyntheticsBrowserError) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Description = all.Description - o.Name = all.Name + o.Description = *all.Description + o.Name = *all.Name o.Status = all.Status - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_browser_test_.go b/api/datadogV1/model_synthetics_browser_test_.go index f8f9742f7e7..56038290df8 100644 --- a/api/datadogV1/model_synthetics_browser_test_.go +++ b/api/datadogV1/model_synthetics_browser_test_.go @@ -381,58 +381,45 @@ func (o SyntheticsBrowserTest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Config *SyntheticsBrowserTestConfig `json:"config"` Locations *[]string `json:"locations"` Message *string `json:"message"` + MonitorId *int64 `json:"monitor_id,omitempty"` Name *string `json:"name"` Options *SyntheticsTestOptions `json:"options"` + PublicId *string `json:"public_id,omitempty"` + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + Steps []SyntheticsStep `json:"steps,omitempty"` + Tags []string `json:"tags,omitempty"` Type *SyntheticsBrowserTestType `json:"type"` }{} - all := struct { - Config SyntheticsBrowserTestConfig `json:"config"` - Locations []string `json:"locations"` - Message string `json:"message"` - MonitorId *int64 `json:"monitor_id,omitempty"` - Name string `json:"name"` - Options SyntheticsTestOptions `json:"options"` - PublicId *string `json:"public_id,omitempty"` - Status *SyntheticsTestPauseStatus `json:"status,omitempty"` - Steps []SyntheticsStep `json:"steps,omitempty"` - Tags []string `json:"tags,omitempty"` - Type SyntheticsBrowserTestType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Config == nil { + if all.Config == nil { return fmt.Errorf("required field config missing") } - if required.Locations == nil { + if all.Locations == nil { return fmt.Errorf("required field locations missing") } - if required.Message == nil { + if all.Message == nil { return fmt.Errorf("required field message missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Options == nil { + if all.Options == nil { return fmt.Errorf("required field options missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"config", "locations", "message", "monitor_id", "name", "options", "public_id", "status", "steps", "tags", "type"}) @@ -462,11 +449,11 @@ func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Config = all.Config - o.Locations = all.Locations - o.Message = all.Message + o.Config = *all.Config + o.Locations = *all.Locations + o.Message = *all.Message o.MonitorId = all.MonitorId - o.Name = all.Name + o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -474,12 +461,12 @@ func (o *SyntheticsBrowserTest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Options = all.Options + o.Options = *all.Options o.PublicId = all.PublicId o.Status = all.Status o.Steps = all.Steps o.Tags = all.Tags - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_browser_test_config.go b/api/datadogV1/model_synthetics_browser_test_config.go index 762bade4cf3..2b7cffa8d1f 100644 --- a/api/datadogV1/model_synthetics_browser_test_config.go +++ b/api/datadogV1/model_synthetics_browser_test_config.go @@ -204,29 +204,14 @@ func (o SyntheticsBrowserTestConfig) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Assertions *[]SyntheticsAssertion `json:"assertions"` - Request *SyntheticsTestRequest `json:"request"` - }{} all := struct { - Assertions []SyntheticsAssertion `json:"assertions"` + Assertions *[]SyntheticsAssertion `json:"assertions"` ConfigVariables []SyntheticsConfigVariable `json:"configVariables,omitempty"` - Request SyntheticsTestRequest `json:"request"` + Request *SyntheticsTestRequest `json:"request"` SetCookie *string `json:"setCookie,omitempty"` Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assertions == nil { - return fmt.Errorf("required field assertions missing") - } - if required.Request == nil { - return fmt.Errorf("required field request missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -234,13 +219,19 @@ func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Assertions == nil { + return fmt.Errorf("required field assertions missing") + } + if all.Request == nil { + return fmt.Errorf("required field request missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"assertions", "configVariables", "request", "setCookie", "variables"}) } else { return err } - o.Assertions = all.Assertions + o.Assertions = *all.Assertions o.ConfigVariables = all.ConfigVariables if all.Request.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -249,7 +240,7 @@ func (o *SyntheticsBrowserTestConfig) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Request = all.Request + o.Request = *all.Request o.SetCookie = all.SetCookie o.Variables = all.Variables if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_synthetics_browser_test_result_data.go b/api/datadogV1/model_synthetics_browser_test_result_data.go index 07d10a6633c..803682fe5b1 100644 --- a/api/datadogV1/model_synthetics_browser_test_result_data.go +++ b/api/datadogV1/model_synthetics_browser_test_result_data.go @@ -461,8 +461,7 @@ func (o *SyntheticsBrowserTestResultData) UnmarshalJSON(bytes []byte) (err error ThumbnailsBucketKey *bool `json:"thumbnailsBucketKey,omitempty"` TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_browser_test_result_failure.go b/api/datadogV1/model_synthetics_browser_test_result_failure.go index bdb63dc9d03..ed103052581 100644 --- a/api/datadogV1/model_synthetics_browser_test_result_failure.go +++ b/api/datadogV1/model_synthetics_browser_test_result_failure.go @@ -120,8 +120,7 @@ func (o *SyntheticsBrowserTestResultFailure) UnmarshalJSON(bytes []byte) (err er Code *SyntheticsBrowserTestFailureCode `json:"code,omitempty"` Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_browser_test_result_full.go b/api/datadogV1/model_synthetics_browser_test_result_full.go index b39fe07b0c1..036e2cac7ab 100644 --- a/api/datadogV1/model_synthetics_browser_test_result_full.go +++ b/api/datadogV1/model_synthetics_browser_test_result_full.go @@ -293,8 +293,7 @@ func (o *SyntheticsBrowserTestResultFull) UnmarshalJSON(bytes []byte) (err error ResultId *string `json:"result_id,omitempty"` Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_browser_test_result_full_check.go b/api/datadogV1/model_synthetics_browser_test_result_full_check.go index 13679cae6ff..0b3da84a78b 100644 --- a/api/datadogV1/model_synthetics_browser_test_result_full_check.go +++ b/api/datadogV1/model_synthetics_browser_test_result_full_check.go @@ -78,21 +78,10 @@ func (o SyntheticsBrowserTestResultFullCheck) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Config *SyntheticsTestConfig `json:"config"` - }{} all := struct { - Config SyntheticsTestConfig `json:"config"` + Config *SyntheticsTestConfig `json:"config"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Config == nil { - return fmt.Errorf("required field config missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Config == nil { + return fmt.Errorf("required field config missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"config"}) @@ -113,7 +105,7 @@ func (o *SyntheticsBrowserTestResultFullCheck) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Config = all.Config + o.Config = *all.Config if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_browser_test_result_short.go b/api/datadogV1/model_synthetics_browser_test_result_short.go index cb1abf027da..65d69bcf371 100644 --- a/api/datadogV1/model_synthetics_browser_test_result_short.go +++ b/api/datadogV1/model_synthetics_browser_test_result_short.go @@ -225,8 +225,7 @@ func (o *SyntheticsBrowserTestResultShort) UnmarshalJSON(bytes []byte) (err erro ResultId *string `json:"result_id,omitempty"` Status *SyntheticsTestMonitorStatus `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_browser_test_result_short_result.go b/api/datadogV1/model_synthetics_browser_test_result_short_result.go index 2645632dcfa..672757482bf 100644 --- a/api/datadogV1/model_synthetics_browser_test_result_short_result.go +++ b/api/datadogV1/model_synthetics_browser_test_result_short_result.go @@ -222,8 +222,7 @@ func (o *SyntheticsBrowserTestResultShortResult) UnmarshalJSON(bytes []byte) (er StepCountCompleted *int64 `json:"stepCountCompleted,omitempty"` StepCountTotal *int64 `json:"stepCountTotal,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_browser_test_rum_settings.go b/api/datadogV1/model_synthetics_browser_test_rum_settings.go index 69bb2652869..5ec7d781f4f 100644 --- a/api/datadogV1/model_synthetics_browser_test_rum_settings.go +++ b/api/datadogV1/model_synthetics_browser_test_rum_settings.go @@ -154,23 +154,12 @@ func (o SyntheticsBrowserTestRumSettings) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - IsEnabled *bool `json:"isEnabled"` - }{} all := struct { ApplicationId *string `json:"applicationId,omitempty"` ClientTokenId *int64 `json:"clientTokenId,omitempty"` - IsEnabled bool `json:"isEnabled"` + IsEnabled *bool `json:"isEnabled"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IsEnabled == nil { - return fmt.Errorf("required field isEnabled missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -178,6 +167,9 @@ func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.IsEnabled == nil { + return fmt.Errorf("required field isEnabled missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"applicationId", "clientTokenId", "isEnabled"}) @@ -186,7 +178,7 @@ func (o *SyntheticsBrowserTestRumSettings) UnmarshalJSON(bytes []byte) (err erro } o.ApplicationId = all.ApplicationId o.ClientTokenId = all.ClientTokenId - o.IsEnabled = all.IsEnabled + o.IsEnabled = *all.IsEnabled if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_browser_variable.go b/api/datadogV1/model_synthetics_browser_variable.go index a5485968def..c22f0a9a1c6 100644 --- a/api/datadogV1/model_synthetics_browser_variable.go +++ b/api/datadogV1/model_synthetics_browser_variable.go @@ -238,30 +238,15 @@ func (o SyntheticsBrowserVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Type *SyntheticsBrowserVariableType `json:"type"` - }{} all := struct { - Example *string `json:"example,omitempty"` - Id *string `json:"id,omitempty"` - Name string `json:"name"` - Pattern *string `json:"pattern,omitempty"` - Secure *bool `json:"secure,omitempty"` - Type SyntheticsBrowserVariableType `json:"type"` + Example *string `json:"example,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name"` + Pattern *string `json:"pattern,omitempty"` + Secure *bool `json:"secure,omitempty"` + Type *SyntheticsBrowserVariableType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -269,6 +254,12 @@ func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"example", "id", "name", "pattern", "secure", "type"}) @@ -285,10 +276,10 @@ func (o *SyntheticsBrowserVariable) UnmarshalJSON(bytes []byte) (err error) { } o.Example = all.Example o.Id = all.Id - o.Name = all.Name + o.Name = *all.Name o.Pattern = all.Pattern o.Secure = all.Secure - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_ci_batch_metadata.go b/api/datadogV1/model_synthetics_ci_batch_metadata.go index 8e5a228241e..855d3b1ff00 100644 --- a/api/datadogV1/model_synthetics_ci_batch_metadata.go +++ b/api/datadogV1/model_synthetics_ci_batch_metadata.go @@ -120,8 +120,7 @@ func (o *SyntheticsCIBatchMetadata) UnmarshalJSON(bytes []byte) (err error) { Ci *SyntheticsCIBatchMetadataCI `json:"ci,omitempty"` Git *SyntheticsCIBatchMetadataGit `json:"git,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go b/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go index 7e30cf77fc3..e2f7670fb09 100644 --- a/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go +++ b/api/datadogV1/model_synthetics_ci_batch_metadata_ci.go @@ -120,8 +120,7 @@ func (o *SyntheticsCIBatchMetadataCI) UnmarshalJSON(bytes []byte) (err error) { Pipeline *SyntheticsCIBatchMetadataPipeline `json:"pipeline,omitempty"` Provider *SyntheticsCIBatchMetadataProvider `json:"provider,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ci_batch_metadata_git.go b/api/datadogV1/model_synthetics_ci_batch_metadata_git.go index 1066faa3603..29e2ffae82d 100644 --- a/api/datadogV1/model_synthetics_ci_batch_metadata_git.go +++ b/api/datadogV1/model_synthetics_ci_batch_metadata_git.go @@ -120,8 +120,7 @@ func (o *SyntheticsCIBatchMetadataGit) UnmarshalJSON(bytes []byte) (err error) { Branch *string `json:"branch,omitempty"` CommitSha *string `json:"commitSha,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go b/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go index 157210346e8..cae8c34c0ea 100644 --- a/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go +++ b/api/datadogV1/model_synthetics_ci_batch_metadata_pipeline.go @@ -86,8 +86,7 @@ func (o *SyntheticsCIBatchMetadataPipeline) UnmarshalJSON(bytes []byte) (err err all := struct { Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go b/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go index b308e70b737..aaecec06e71 100644 --- a/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go +++ b/api/datadogV1/model_synthetics_ci_batch_metadata_provider.go @@ -86,8 +86,7 @@ func (o *SyntheticsCIBatchMetadataProvider) UnmarshalJSON(bytes []byte) (err err all := struct { Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ci_test_.go b/api/datadogV1/model_synthetics_ci_test_.go index d139da338a8..d3afb9ae7fc 100644 --- a/api/datadogV1/model_synthetics_ci_test_.go +++ b/api/datadogV1/model_synthetics_ci_test_.go @@ -507,9 +507,6 @@ func (o SyntheticsCITest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - PublicId *string `json:"public_id"` - }{} all := struct { AllowInsecureCertificates *bool `json:"allowInsecureCertificates,omitempty"` BasicAuth *SyntheticsBasicAuth `json:"basicAuth,omitempty"` @@ -521,20 +518,12 @@ func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { Headers map[string]string `json:"headers,omitempty"` Locations []string `json:"locations,omitempty"` Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - PublicId string `json:"public_id"` + PublicId *string `json:"public_id"` Retry *SyntheticsTestOptionsRetry `json:"retry,omitempty"` StartUrl *string `json:"startUrl,omitempty"` Variables map[string]string `json:"variables,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.PublicId == nil { - return fmt.Errorf("required field public_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -542,6 +531,9 @@ func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.PublicId == nil { + return fmt.Errorf("required field public_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"allowInsecureCertificates", "basicAuth", "body", "bodyType", "cookies", "deviceIds", "followRedirects", "headers", "locations", "metadata", "public_id", "retry", "startUrl", "variables"}) @@ -565,7 +557,7 @@ func (o *SyntheticsCITest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.PublicId = all.PublicId + o.PublicId = *all.PublicId if all.Retry != nil && all.Retry.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_synthetics_ci_test_body.go b/api/datadogV1/model_synthetics_ci_test_body.go index 24e197808d6..490fa7f3491 100644 --- a/api/datadogV1/model_synthetics_ci_test_body.go +++ b/api/datadogV1/model_synthetics_ci_test_body.go @@ -86,8 +86,7 @@ func (o *SyntheticsCITestBody) UnmarshalJSON(bytes []byte) (err error) { all := struct { Tests []SyntheticsCITest `json:"tests,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_config_variable.go b/api/datadogV1/model_synthetics_config_variable.go index f6dfdcc08fa..d3a78077cb2 100644 --- a/api/datadogV1/model_synthetics_config_variable.go +++ b/api/datadogV1/model_synthetics_config_variable.go @@ -237,30 +237,15 @@ func (o SyntheticsConfigVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Type *SyntheticsConfigVariableType `json:"type"` - }{} all := struct { - Example *string `json:"example,omitempty"` - Id *string `json:"id,omitempty"` - Name string `json:"name"` - Pattern *string `json:"pattern,omitempty"` - Secure *bool `json:"secure,omitempty"` - Type SyntheticsConfigVariableType `json:"type"` + Example *string `json:"example,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name"` + Pattern *string `json:"pattern,omitempty"` + Secure *bool `json:"secure,omitempty"` + Type *SyntheticsConfigVariableType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -268,6 +253,12 @@ func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"example", "id", "name", "pattern", "secure", "type"}) @@ -284,10 +275,10 @@ func (o *SyntheticsConfigVariable) UnmarshalJSON(bytes []byte) (err error) { } o.Example = all.Example o.Id = all.Id - o.Name = all.Name + o.Name = *all.Name o.Pattern = all.Pattern o.Secure = all.Secure - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_core_web_vitals.go b/api/datadogV1/model_synthetics_core_web_vitals.go index cc5e9bebbd8..de7e26783d1 100644 --- a/api/datadogV1/model_synthetics_core_web_vitals.go +++ b/api/datadogV1/model_synthetics_core_web_vitals.go @@ -154,8 +154,7 @@ func (o *SyntheticsCoreWebVitals) UnmarshalJSON(bytes []byte) (err error) { Lcp *float64 `json:"lcp,omitempty"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_delete_tests_payload.go b/api/datadogV1/model_synthetics_delete_tests_payload.go index a8a63fd446c..b5fc2f27b11 100644 --- a/api/datadogV1/model_synthetics_delete_tests_payload.go +++ b/api/datadogV1/model_synthetics_delete_tests_payload.go @@ -87,8 +87,7 @@ func (o *SyntheticsDeleteTestsPayload) UnmarshalJSON(bytes []byte) (err error) { all := struct { PublicIds []string `json:"public_ids,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_delete_tests_response.go b/api/datadogV1/model_synthetics_delete_tests_response.go index 2e9adf5a9c3..852cab42880 100644 --- a/api/datadogV1/model_synthetics_delete_tests_response.go +++ b/api/datadogV1/model_synthetics_delete_tests_response.go @@ -87,8 +87,7 @@ func (o *SyntheticsDeleteTestsResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { DeletedTests []SyntheticsDeletedTest `json:"deleted_tests,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_deleted_test_.go b/api/datadogV1/model_synthetics_deleted_test_.go index 605049ca098..8ec7c768cb9 100644 --- a/api/datadogV1/model_synthetics_deleted_test_.go +++ b/api/datadogV1/model_synthetics_deleted_test_.go @@ -126,8 +126,7 @@ func (o *SyntheticsDeletedTest) UnmarshalJSON(bytes []byte) (err error) { DeletedAt *time.Time `json:"deleted_at,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_device.go b/api/datadogV1/model_synthetics_device.go index 9b899b8b628..08573ce919c 100644 --- a/api/datadogV1/model_synthetics_device.go +++ b/api/datadogV1/model_synthetics_device.go @@ -192,44 +192,33 @@ func (o SyntheticsDevice) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Height *int64 `json:"height"` - Id *SyntheticsDeviceID `json:"id"` - Name *string `json:"name"` - Width *int64 `json:"width"` - }{} all := struct { - Height int64 `json:"height"` - Id SyntheticsDeviceID `json:"id"` - IsMobile *bool `json:"isMobile,omitempty"` - Name string `json:"name"` - Width int64 `json:"width"` + Height *int64 `json:"height"` + Id *SyntheticsDeviceID `json:"id"` + IsMobile *bool `json:"isMobile,omitempty"` + Name *string `json:"name"` + Width *int64 `json:"width"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Height == nil { + if all.Height == nil { return fmt.Errorf("required field height missing") } - if required.Id == nil { + if all.Id == nil { return fmt.Errorf("required field id missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Width == nil { + if all.Width == nil { return fmt.Errorf("required field width missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"height", "id", "isMobile", "name", "width"}) @@ -244,11 +233,11 @@ func (o *SyntheticsDevice) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Height = all.Height - o.Id = all.Id + o.Height = *all.Height + o.Id = *all.Id o.IsMobile = all.IsMobile - o.Name = all.Name - o.Width = all.Width + o.Name = *all.Name + o.Width = *all.Width if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go b/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go index d314697f281..00eef5d5020 100644 --- a/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go +++ b/api/datadogV1/model_synthetics_get_api_test_latest_results_response.go @@ -120,8 +120,7 @@ func (o *SyntheticsGetAPITestLatestResultsResponse) UnmarshalJSON(bytes []byte) LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` Results []SyntheticsAPITestResultShort `json:"results,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go b/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go index 01f422d1170..4d6c3ed44e4 100644 --- a/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go +++ b/api/datadogV1/model_synthetics_get_browser_test_latest_results_response.go @@ -120,8 +120,7 @@ func (o *SyntheticsGetBrowserTestLatestResultsResponse) UnmarshalJSON(bytes []by LastTimestampFetched *int64 `json:"last_timestamp_fetched,omitempty"` Results []SyntheticsBrowserTestResultShort `json:"results,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_global_variable.go b/api/datadogV1/model_synthetics_global_variable.go index 067d0ba3533..98721fa0e81 100644 --- a/api/datadogV1/model_synthetics_global_variable.go +++ b/api/datadogV1/model_synthetics_global_variable.go @@ -291,47 +291,36 @@ func (o SyntheticsGlobalVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Description *string `json:"description"` - Name *string `json:"name"` - Tags *[]string `json:"tags"` - Value *SyntheticsGlobalVariableValue `json:"value"` - }{} all := struct { Attributes *SyntheticsGlobalVariableAttributes `json:"attributes,omitempty"` - Description string `json:"description"` + Description *string `json:"description"` Id *string `json:"id,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` ParseTestOptions *SyntheticsGlobalVariableParseTestOptions `json:"parse_test_options,omitempty"` ParseTestPublicId *string `json:"parse_test_public_id,omitempty"` - Tags []string `json:"tags"` - Value SyntheticsGlobalVariableValue `json:"value"` + Tags *[]string `json:"tags"` + Value *SyntheticsGlobalVariableValue `json:"value"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Description == nil { + if all.Description == nil { return fmt.Errorf("required field description missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Tags == nil { + if all.Tags == nil { return fmt.Errorf("required field tags missing") } - if required.Value == nil { + if all.Value == nil { return fmt.Errorf("required field value missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "description", "id", "name", "parse_test_options", "parse_test_public_id", "tags", "value"}) @@ -346,9 +335,9 @@ func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Description = all.Description + o.Description = *all.Description o.Id = all.Id - o.Name = all.Name + o.Name = *all.Name if all.ParseTestOptions != nil && all.ParseTestOptions.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -358,7 +347,7 @@ func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { } o.ParseTestOptions = all.ParseTestOptions o.ParseTestPublicId = all.ParseTestPublicId - o.Tags = all.Tags + o.Tags = *all.Tags if all.Value.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -366,7 +355,7 @@ func (o *SyntheticsGlobalVariable) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Value = all.Value + o.Value = *all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_global_variable_attributes.go b/api/datadogV1/model_synthetics_global_variable_attributes.go index 39f67dd88a4..2796d9aaa7f 100644 --- a/api/datadogV1/model_synthetics_global_variable_attributes.go +++ b/api/datadogV1/model_synthetics_global_variable_attributes.go @@ -86,8 +86,7 @@ func (o *SyntheticsGlobalVariableAttributes) UnmarshalJSON(bytes []byte) (err er all := struct { RestrictedRoles []string `json:"restricted_roles,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_global_variable_options.go b/api/datadogV1/model_synthetics_global_variable_options.go index 07106151e74..f4565cb1f9a 100644 --- a/api/datadogV1/model_synthetics_global_variable_options.go +++ b/api/datadogV1/model_synthetics_global_variable_options.go @@ -86,8 +86,7 @@ func (o *SyntheticsGlobalVariableOptions) UnmarshalJSON(bytes []byte) (err error all := struct { TotpParameters *SyntheticsGlobalVariableTOTPParameters `json:"totp_parameters,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_global_variable_parse_test_options.go b/api/datadogV1/model_synthetics_global_variable_parse_test_options.go index 9aef51d8cdb..1c939576269 100644 --- a/api/datadogV1/model_synthetics_global_variable_parse_test_options.go +++ b/api/datadogV1/model_synthetics_global_variable_parse_test_options.go @@ -177,24 +177,13 @@ func (o SyntheticsGlobalVariableParseTestOptions) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"` - }{} all := struct { - Field *string `json:"field,omitempty"` - LocalVariableName *string `json:"localVariableName,omitempty"` - Parser *SyntheticsVariableParser `json:"parser,omitempty"` - Type SyntheticsGlobalVariableParseTestOptionsType `json:"type"` + Field *string `json:"field,omitempty"` + LocalVariableName *string `json:"localVariableName,omitempty"` + Parser *SyntheticsVariableParser `json:"parser,omitempty"` + Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +191,9 @@ func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"field", "localVariableName", "parser", "type"}) @@ -226,7 +218,7 @@ func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw } o.Parser = all.Parser - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_global_variable_totp_parameters.go b/api/datadogV1/model_synthetics_global_variable_totp_parameters.go index 73157ddb517..74dbbe92123 100644 --- a/api/datadogV1/model_synthetics_global_variable_totp_parameters.go +++ b/api/datadogV1/model_synthetics_global_variable_totp_parameters.go @@ -120,8 +120,7 @@ func (o *SyntheticsGlobalVariableTOTPParameters) UnmarshalJSON(bytes []byte) (er Digits *int32 `json:"digits,omitempty"` RefreshInterval *int32 `json:"refresh_interval,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_global_variable_value.go b/api/datadogV1/model_synthetics_global_variable_value.go index 399fede3276..3803f1740c0 100644 --- a/api/datadogV1/model_synthetics_global_variable_value.go +++ b/api/datadogV1/model_synthetics_global_variable_value.go @@ -155,8 +155,7 @@ func (o *SyntheticsGlobalVariableValue) UnmarshalJSON(bytes []byte) (err error) Secure *bool `json:"secure,omitempty"` Value *string `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_list_global_variables_response.go b/api/datadogV1/model_synthetics_list_global_variables_response.go index 650a1033874..cc76bfd6e5e 100644 --- a/api/datadogV1/model_synthetics_list_global_variables_response.go +++ b/api/datadogV1/model_synthetics_list_global_variables_response.go @@ -86,8 +86,7 @@ func (o *SyntheticsListGlobalVariablesResponse) UnmarshalJSON(bytes []byte) (err all := struct { Variables []SyntheticsGlobalVariable `json:"variables,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_list_tests_response.go b/api/datadogV1/model_synthetics_list_tests_response.go index 61af8fa3249..81335cff6da 100644 --- a/api/datadogV1/model_synthetics_list_tests_response.go +++ b/api/datadogV1/model_synthetics_list_tests_response.go @@ -86,8 +86,7 @@ func (o *SyntheticsListTestsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Tests []SyntheticsTestDetails `json:"tests,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_location.go b/api/datadogV1/model_synthetics_location.go index f31762cc57a..2e5900cd2b1 100644 --- a/api/datadogV1/model_synthetics_location.go +++ b/api/datadogV1/model_synthetics_location.go @@ -121,8 +121,7 @@ func (o *SyntheticsLocation) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_locations.go b/api/datadogV1/model_synthetics_locations.go index 0035ec3b016..5a32c758eba 100644 --- a/api/datadogV1/model_synthetics_locations.go +++ b/api/datadogV1/model_synthetics_locations.go @@ -86,8 +86,7 @@ func (o *SyntheticsLocations) UnmarshalJSON(bytes []byte) (err error) { all := struct { Locations []SyntheticsLocation `json:"locations,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_parsing_options.go b/api/datadogV1/model_synthetics_parsing_options.go index 40bbcb19dae..98a84bc2c22 100644 --- a/api/datadogV1/model_synthetics_parsing_options.go +++ b/api/datadogV1/model_synthetics_parsing_options.go @@ -222,8 +222,7 @@ func (o *SyntheticsParsingOptions) UnmarshalJSON(bytes []byte) (err error) { Secure *bool `json:"secure,omitempty"` Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_private_location.go b/api/datadogV1/model_synthetics_private_location.go index 2129ccbff3e..c5d533c96bf 100644 --- a/api/datadogV1/model_synthetics_private_location.go +++ b/api/datadogV1/model_synthetics_private_location.go @@ -231,34 +231,15 @@ func (o SyntheticsPrivateLocation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Description *string `json:"description"` - Name *string `json:"name"` - Tags *[]string `json:"tags"` - }{} all := struct { - Description string `json:"description"` + Description *string `json:"description"` Id *string `json:"id,omitempty"` Metadata *SyntheticsPrivateLocationMetadata `json:"metadata,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Secrets *SyntheticsPrivateLocationSecrets `json:"secrets,omitempty"` - Tags []string `json:"tags"` + Tags *[]string `json:"tags"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Description == nil { - return fmt.Errorf("required field description missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Tags == nil { - return fmt.Errorf("required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -266,13 +247,22 @@ func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Tags == nil { + return fmt.Errorf("required field tags missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"description", "id", "metadata", "name", "secrets", "tags"}) } else { return err } - o.Description = all.Description + o.Description = *all.Description o.Id = all.Id if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -282,7 +272,7 @@ func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.Name = all.Name + o.Name = *all.Name if all.Secrets != nil && all.Secrets.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -291,7 +281,7 @@ func (o *SyntheticsPrivateLocation) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Secrets = all.Secrets - o.Tags = all.Tags + o.Tags = *all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_private_location_creation_response.go b/api/datadogV1/model_synthetics_private_location_creation_response.go index 72246f0e7b5..b225ae55d8c 100644 --- a/api/datadogV1/model_synthetics_private_location_creation_response.go +++ b/api/datadogV1/model_synthetics_private_location_creation_response.go @@ -154,8 +154,7 @@ func (o *SyntheticsPrivateLocationCreationResponse) UnmarshalJSON(bytes []byte) PrivateLocation *SyntheticsPrivateLocation `json:"private_location,omitempty"` ResultEncryption *SyntheticsPrivateLocationCreationResponseResultEncryption `json:"result_encryption,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go b/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go index 33983a84b69..6abbf15c27b 100644 --- a/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go +++ b/api/datadogV1/model_synthetics_private_location_creation_response_result_encryption.go @@ -120,8 +120,7 @@ func (o *SyntheticsPrivateLocationCreationResponseResultEncryption) UnmarshalJSO Id *string `json:"id,omitempty"` Key *string `json:"key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_private_location_metadata.go b/api/datadogV1/model_synthetics_private_location_metadata.go index 8ea52ae79a3..e8501121d81 100644 --- a/api/datadogV1/model_synthetics_private_location_metadata.go +++ b/api/datadogV1/model_synthetics_private_location_metadata.go @@ -86,8 +86,7 @@ func (o *SyntheticsPrivateLocationMetadata) UnmarshalJSON(bytes []byte) (err err all := struct { RestrictedRoles []string `json:"restricted_roles,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_private_location_secrets.go b/api/datadogV1/model_synthetics_private_location_secrets.go index 732289655e3..f8b601302cb 100644 --- a/api/datadogV1/model_synthetics_private_location_secrets.go +++ b/api/datadogV1/model_synthetics_private_location_secrets.go @@ -120,8 +120,7 @@ func (o *SyntheticsPrivateLocationSecrets) UnmarshalJSON(bytes []byte) (err erro Authentication *SyntheticsPrivateLocationSecretsAuthentication `json:"authentication,omitempty"` ConfigDecryption *SyntheticsPrivateLocationSecretsConfigDecryption `json:"config_decryption,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_private_location_secrets_authentication.go b/api/datadogV1/model_synthetics_private_location_secrets_authentication.go index 2af7f206f00..f3aac72abc3 100644 --- a/api/datadogV1/model_synthetics_private_location_secrets_authentication.go +++ b/api/datadogV1/model_synthetics_private_location_secrets_authentication.go @@ -120,8 +120,7 @@ func (o *SyntheticsPrivateLocationSecretsAuthentication) UnmarshalJSON(bytes []b Id *string `json:"id,omitempty"` Key *string `json:"key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go b/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go index 6942468501f..27c933f9822 100644 --- a/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go +++ b/api/datadogV1/model_synthetics_private_location_secrets_config_decryption.go @@ -86,8 +86,7 @@ func (o *SyntheticsPrivateLocationSecretsConfigDecryption) UnmarshalJSON(bytes [ all := struct { Key *string `json:"key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ssl_certificate.go b/api/datadogV1/model_synthetics_ssl_certificate.go index edfca286587..cf87d7013e8 100644 --- a/api/datadogV1/model_synthetics_ssl_certificate.go +++ b/api/datadogV1/model_synthetics_ssl_certificate.go @@ -469,8 +469,7 @@ func (o *SyntheticsSSLCertificate) UnmarshalJSON(bytes []byte) (err error) { ValidFrom *time.Time `json:"validFrom,omitempty"` ValidTo *time.Time `json:"validTo,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ssl_certificate_issuer.go b/api/datadogV1/model_synthetics_ssl_certificate_issuer.go index cba08bf550a..c1715d528ce 100644 --- a/api/datadogV1/model_synthetics_ssl_certificate_issuer.go +++ b/api/datadogV1/model_synthetics_ssl_certificate_issuer.go @@ -256,8 +256,7 @@ func (o *SyntheticsSSLCertificateIssuer) UnmarshalJSON(bytes []byte) (err error) Ou *string `json:"OU,omitempty"` St *string `json:"ST,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_ssl_certificate_subject.go b/api/datadogV1/model_synthetics_ssl_certificate_subject.go index d7e2265cf8a..33256f8ee3d 100644 --- a/api/datadogV1/model_synthetics_ssl_certificate_subject.go +++ b/api/datadogV1/model_synthetics_ssl_certificate_subject.go @@ -290,8 +290,7 @@ func (o *SyntheticsSSLCertificateSubject) UnmarshalJSON(bytes []byte) (err error St *string `json:"ST,omitempty"` AltName *string `json:"altName,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_step.go b/api/datadogV1/model_synthetics_step.go index 75d010ffb9e..e1798e0d175 100644 --- a/api/datadogV1/model_synthetics_step.go +++ b/api/datadogV1/model_synthetics_step.go @@ -290,8 +290,7 @@ func (o *SyntheticsStep) UnmarshalJSON(bytes []byte) (err error) { Timeout *int64 `json:"timeout,omitempty"` Type *SyntheticsStepType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_step_detail.go b/api/datadogV1/model_synthetics_step_detail.go index 832fbcc9376..2944425f6d1 100644 --- a/api/datadogV1/model_synthetics_step_detail.go +++ b/api/datadogV1/model_synthetics_step_detail.go @@ -631,8 +631,7 @@ func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { VitalsMetrics []SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` Warnings []SyntheticsStepDetailWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_step_detail_warning.go b/api/datadogV1/model_synthetics_step_detail_warning.go index e3618ae182a..bd8b35e35e2 100644 --- a/api/datadogV1/model_synthetics_step_detail_warning.go +++ b/api/datadogV1/model_synthetics_step_detail_warning.go @@ -105,26 +105,11 @@ func (o SyntheticsStepDetailWarning) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Message *string `json:"message"` Type *SyntheticsWarningType `json:"type"` }{} - all := struct { - Message string `json:"message"` - Type SyntheticsWarningType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("required field message missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Message == nil { + return fmt.Errorf("required field message missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"message", "type"}) @@ -146,8 +137,8 @@ func (o *SyntheticsStepDetailWarning) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Message = all.Message - o.Type = all.Type + o.Message = *all.Message + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_test_ci_options.go b/api/datadogV1/model_synthetics_test_ci_options.go index f8344953841..ef7108fbd54 100644 --- a/api/datadogV1/model_synthetics_test_ci_options.go +++ b/api/datadogV1/model_synthetics_test_ci_options.go @@ -86,8 +86,7 @@ func (o *SyntheticsTestCiOptions) UnmarshalJSON(bytes []byte) (err error) { all := struct { ExecutionRule *SyntheticsTestExecutionRule `json:"executionRule,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_config.go b/api/datadogV1/model_synthetics_test_config.go index c2db8adb11a..8be7a3802bb 100644 --- a/api/datadogV1/model_synthetics_test_config.go +++ b/api/datadogV1/model_synthetics_test_config.go @@ -188,8 +188,7 @@ func (o *SyntheticsTestConfig) UnmarshalJSON(bytes []byte) (err error) { Request *SyntheticsTestRequest `json:"request,omitempty"` Variables []SyntheticsBrowserVariable `json:"variables,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_details.go b/api/datadogV1/model_synthetics_test_details.go index 5a0bf575acd..5e165f45749 100644 --- a/api/datadogV1/model_synthetics_test_details.go +++ b/api/datadogV1/model_synthetics_test_details.go @@ -496,8 +496,7 @@ func (o *SyntheticsTestDetails) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Type *SyntheticsTestDetailsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_options.go b/api/datadogV1/model_synthetics_test_options.go index a2468c09b1a..701d727d426 100644 --- a/api/datadogV1/model_synthetics_test_options.go +++ b/api/datadogV1/model_synthetics_test_options.go @@ -813,8 +813,7 @@ func (o *SyntheticsTestOptions) UnmarshalJSON(bytes []byte) (err error) { Scheduling *SyntheticsTestOptionsScheduling `json:"scheduling,omitempty"` TickEvery *int64 `json:"tick_every,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_options_monitor_options.go b/api/datadogV1/model_synthetics_test_options_monitor_options.go index 243f3c80c3e..36653d5a433 100644 --- a/api/datadogV1/model_synthetics_test_options_monitor_options.go +++ b/api/datadogV1/model_synthetics_test_options_monitor_options.go @@ -88,8 +88,7 @@ func (o *SyntheticsTestOptionsMonitorOptions) UnmarshalJSON(bytes []byte) (err e all := struct { RenotifyInterval *int64 `json:"renotify_interval,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_options_retry.go b/api/datadogV1/model_synthetics_test_options_retry.go index b6fb4dab6a6..a8cf021eaeb 100644 --- a/api/datadogV1/model_synthetics_test_options_retry.go +++ b/api/datadogV1/model_synthetics_test_options_retry.go @@ -122,8 +122,7 @@ func (o *SyntheticsTestOptionsRetry) UnmarshalJSON(bytes []byte) (err error) { Count *int64 `json:"count,omitempty"` Interval *float64 `json:"interval,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_options_scheduling.go b/api/datadogV1/model_synthetics_test_options_scheduling.go index a94ee8a0d77..121bb298792 100644 --- a/api/datadogV1/model_synthetics_test_options_scheduling.go +++ b/api/datadogV1/model_synthetics_test_options_scheduling.go @@ -120,8 +120,7 @@ func (o *SyntheticsTestOptionsScheduling) UnmarshalJSON(bytes []byte) (err error Timeframes []SyntheticsTestOptionsSchedulingTimeframe `json:"timeframes,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go b/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go index a6c16e5bd0a..6dae0aea0d2 100644 --- a/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go +++ b/api/datadogV1/model_synthetics_test_options_scheduling_timeframe.go @@ -154,8 +154,7 @@ func (o *SyntheticsTestOptionsSchedulingTimeframe) UnmarshalJSON(bytes []byte) ( From *string `json:"from,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_request.go b/api/datadogV1/model_synthetics_test_request.go index 6a2eedb3be8..fef53d6e7c7 100644 --- a/api/datadogV1/model_synthetics_test_request.go +++ b/api/datadogV1/model_synthetics_test_request.go @@ -938,8 +938,7 @@ func (o *SyntheticsTestRequest) UnmarshalJSON(bytes []byte) (err error) { Timeout *float64 `json:"timeout,omitempty"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_request_certificate.go b/api/datadogV1/model_synthetics_test_request_certificate.go index abf230a76f5..1b6b8456f5e 100644 --- a/api/datadogV1/model_synthetics_test_request_certificate.go +++ b/api/datadogV1/model_synthetics_test_request_certificate.go @@ -120,8 +120,7 @@ func (o *SyntheticsTestRequestCertificate) UnmarshalJSON(bytes []byte) (err erro Cert *SyntheticsTestRequestCertificateItem `json:"cert,omitempty"` Key *SyntheticsTestRequestCertificateItem `json:"key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_request_certificate_item.go b/api/datadogV1/model_synthetics_test_request_certificate_item.go index 8aa512e31a9..5775c3e204c 100644 --- a/api/datadogV1/model_synthetics_test_request_certificate_item.go +++ b/api/datadogV1/model_synthetics_test_request_certificate_item.go @@ -154,8 +154,7 @@ func (o *SyntheticsTestRequestCertificateItem) UnmarshalJSON(bytes []byte) (err Filename *string `json:"filename,omitempty"` UpdatedAt *string `json:"updatedAt,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_test_request_proxy.go b/api/datadogV1/model_synthetics_test_request_proxy.go index fc21dfc5b48..7d3a8542989 100644 --- a/api/datadogV1/model_synthetics_test_request_proxy.go +++ b/api/datadogV1/model_synthetics_test_request_proxy.go @@ -111,22 +111,11 @@ func (o SyntheticsTestRequestProxy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Url *string `json:"url"` - }{} all := struct { Headers map[string]string `json:"headers,omitempty"` - Url string `json:"url"` + Url *string `json:"url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"headers", "url"}) @@ -141,7 +133,7 @@ func (o *SyntheticsTestRequestProxy) UnmarshalJSON(bytes []byte) (err error) { return err } o.Headers = all.Headers - o.Url = all.Url + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_timing.go b/api/datadogV1/model_synthetics_timing.go index ac75171e97a..dd47e5c31c8 100644 --- a/api/datadogV1/model_synthetics_timing.go +++ b/api/datadogV1/model_synthetics_timing.go @@ -359,8 +359,7 @@ func (o *SyntheticsTiming) UnmarshalJSON(bytes []byte) (err error) { Total *float64 `json:"total,omitempty"` Wait *float64 `json:"wait,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_trigger_body.go b/api/datadogV1/model_synthetics_trigger_body.go index 3cc07294331..7c998bbdccd 100644 --- a/api/datadogV1/model_synthetics_trigger_body.go +++ b/api/datadogV1/model_synthetics_trigger_body.go @@ -78,21 +78,10 @@ func (o SyntheticsTriggerBody) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerBody) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Tests *[]SyntheticsTriggerTest `json:"tests"` - }{} all := struct { - Tests []SyntheticsTriggerTest `json:"tests"` + Tests *[]SyntheticsTriggerTest `json:"tests"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Tests == nil { - return fmt.Errorf("required field tests missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *SyntheticsTriggerBody) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Tests == nil { + return fmt.Errorf("required field tests missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"tests"}) } else { return err } - o.Tests = all.Tests + o.Tests = *all.Tests if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_trigger_ci_test_location.go b/api/datadogV1/model_synthetics_trigger_ci_test_location.go index 426e05873d6..b00fba955af 100644 --- a/api/datadogV1/model_synthetics_trigger_ci_test_location.go +++ b/api/datadogV1/model_synthetics_trigger_ci_test_location.go @@ -120,8 +120,7 @@ func (o *SyntheticsTriggerCITestLocation) UnmarshalJSON(bytes []byte) (err error Id *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go b/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go index ca70856ef25..677755fcd73 100644 --- a/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go +++ b/api/datadogV1/model_synthetics_trigger_ci_test_run_result.go @@ -188,8 +188,7 @@ func (o *SyntheticsTriggerCITestRunResult) UnmarshalJSON(bytes []byte) (err erro PublicId *string `json:"public_id,omitempty"` ResultId *string `json:"result_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_trigger_ci_tests_response.go b/api/datadogV1/model_synthetics_trigger_ci_tests_response.go index 44514d8d34b..dc00ce63afc 100644 --- a/api/datadogV1/model_synthetics_trigger_ci_tests_response.go +++ b/api/datadogV1/model_synthetics_trigger_ci_tests_response.go @@ -199,8 +199,7 @@ func (o *SyntheticsTriggerCITestsResponse) UnmarshalJSON(bytes []byte) (err erro Results []SyntheticsTriggerCITestRunResult `json:"results,omitempty"` TriggeredCheckIds []string `json:"triggered_check_ids,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_trigger_test_.go b/api/datadogV1/model_synthetics_trigger_test_.go index 006c5bd3fda..fc5e64ec9e2 100644 --- a/api/datadogV1/model_synthetics_trigger_test_.go +++ b/api/datadogV1/model_synthetics_trigger_test_.go @@ -111,22 +111,11 @@ func (o SyntheticsTriggerTest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - PublicId *string `json:"public_id"` - }{} all := struct { Metadata *SyntheticsCIBatchMetadata `json:"metadata,omitempty"` - PublicId string `json:"public_id"` + PublicId *string `json:"public_id"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.PublicId == nil { - return fmt.Errorf("required field public_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.PublicId == nil { + return fmt.Errorf("required field public_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"metadata", "public_id"}) @@ -148,7 +140,7 @@ func (o *SyntheticsTriggerTest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.PublicId = all.PublicId + o.PublicId = *all.PublicId if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_synthetics_update_test_pause_status_payload.go b/api/datadogV1/model_synthetics_update_test_pause_status_payload.go index ee6c72e71b0..706f30d0f98 100644 --- a/api/datadogV1/model_synthetics_update_test_pause_status_payload.go +++ b/api/datadogV1/model_synthetics_update_test_pause_status_payload.go @@ -87,8 +87,7 @@ func (o *SyntheticsUpdateTestPauseStatusPayload) UnmarshalJSON(bytes []byte) (er all := struct { NewStatus *SyntheticsTestPauseStatus `json:"new_status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_synthetics_variable_parser.go b/api/datadogV1/model_synthetics_variable_parser.go index 9491e741d0d..83f5895aced 100644 --- a/api/datadogV1/model_synthetics_variable_parser.go +++ b/api/datadogV1/model_synthetics_variable_parser.go @@ -111,22 +111,11 @@ func (o SyntheticsVariableParser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *SyntheticsGlobalVariableParserType `json:"type"` - }{} all := struct { - Type SyntheticsGlobalVariableParserType `json:"type"` - Value *string `json:"value,omitempty"` + Type *SyntheticsGlobalVariableParserType `json:"type"` + Value *string `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"type", "value"}) @@ -148,7 +140,7 @@ func (o *SyntheticsVariableParser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Type = all.Type + o.Type = *all.Type o.Value = all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_table_widget_definition.go b/api/datadogV1/model_table_widget_definition.go index 47920d5d137..8c181ba985a 100644 --- a/api/datadogV1/model_table_widget_definition.go +++ b/api/datadogV1/model_table_widget_definition.go @@ -305,32 +305,17 @@ func (o TableWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]TableWidgetRequest `json:"requests"` - Type *TableWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` - Requests []TableWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type TableWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + HasSearchBar *TableWidgetHasSearchBar `json:"has_search_bar,omitempty"` + Requests *[]TableWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *TableWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -338,6 +323,12 @@ func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "has_search_bar", "requests", "time", "title", "title_align", "title_size", "type"}) @@ -370,7 +361,7 @@ func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.CustomLinks = all.CustomLinks o.HasSearchBar = all.HasSearchBar - o.Requests = all.Requests + o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -382,7 +373,7 @@ func (o *TableWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_table_widget_request.go b/api/datadogV1/model_table_widget_request.go index 63002d7dd51..dcc08774cb6 100644 --- a/api/datadogV1/model_table_widget_request.go +++ b/api/datadogV1/model_table_widget_request.go @@ -698,8 +698,7 @@ func (o *TableWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_tag_to_hosts.go b/api/datadogV1/model_tag_to_hosts.go index d4b448e6ed7..a2eb113a3c1 100644 --- a/api/datadogV1/model_tag_to_hosts.go +++ b/api/datadogV1/model_tag_to_hosts.go @@ -86,8 +86,7 @@ func (o *TagToHosts) UnmarshalJSON(bytes []byte) (err error) { all := struct { Tags map[string][]string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_timeseries_background.go b/api/datadogV1/model_timeseries_background.go index 73d272ef232..ac04e7bc00b 100644 --- a/api/datadogV1/model_timeseries_background.go +++ b/api/datadogV1/model_timeseries_background.go @@ -113,22 +113,11 @@ func (o TimeseriesBackground) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *TimeseriesBackgroundType `json:"type"` - }{} all := struct { - Type TimeseriesBackgroundType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` + Type *TimeseriesBackgroundType `json:"type"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -136,6 +125,9 @@ func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"type", "yaxis"}) @@ -150,7 +142,7 @@ func (o *TimeseriesBackground) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Type = all.Type + o.Type = *all.Type if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_timeseries_widget_definition.go b/api/datadogV1/model_timeseries_widget_definition.go index 69f12feda51..8f9367b4771 100644 --- a/api/datadogV1/model_timeseries_widget_definition.go +++ b/api/datadogV1/model_timeseries_widget_definition.go @@ -536,39 +536,24 @@ func (o TimeseriesWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]TimeseriesWidgetRequest `json:"requests"` - Type *TimeseriesWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Events []WidgetEvent `json:"events,omitempty"` - LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"` - LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"` - LegendSize *string `json:"legend_size,omitempty"` - Markers []WidgetMarker `json:"markers,omitempty"` - Requests []TimeseriesWidgetRequest `json:"requests"` - RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"` - ShowLegend *bool `json:"show_legend,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type TimeseriesWidgetDefinitionType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Events []WidgetEvent `json:"events,omitempty"` + LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"` + LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"` + LegendSize *string `json:"legend_size,omitempty"` + Markers []WidgetMarker `json:"markers,omitempty"` + Requests *[]TimeseriesWidgetRequest `json:"requests"` + RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"` + ShowLegend *bool `json:"show_legend,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *TimeseriesWidgetDefinitionType `json:"type"` + Yaxis *WidgetAxis `json:"yaxis,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -576,6 +561,12 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "events", "legend_columns", "legend_layout", "legend_size", "markers", "requests", "right_yaxis", "show_legend", "time", "title", "title_align", "title_size", "type", "yaxis"}) @@ -612,7 +603,7 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.LegendLayout = all.LegendLayout o.LegendSize = all.LegendSize o.Markers = all.Markers - o.Requests = all.Requests + o.Requests = *all.Requests if all.RightYaxis != nil && all.RightYaxis.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -633,7 +624,7 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_timeseries_widget_expression_alias.go b/api/datadogV1/model_timeseries_widget_expression_alias.go index f09d48b02f9..a550b2e51a5 100644 --- a/api/datadogV1/model_timeseries_widget_expression_alias.go +++ b/api/datadogV1/model_timeseries_widget_expression_alias.go @@ -111,22 +111,11 @@ func (o TimeseriesWidgetExpressionAlias) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Expression *string `json:"expression"` - }{} all := struct { AliasName *string `json:"alias_name,omitempty"` - Expression string `json:"expression"` + Expression *string `json:"expression"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Expression == nil { - return fmt.Errorf("required field expression missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Expression == nil { + return fmt.Errorf("required field expression missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"alias_name", "expression"}) @@ -141,7 +133,7 @@ func (o *TimeseriesWidgetExpressionAlias) UnmarshalJSON(bytes []byte) (err error return err } o.AliasName = all.AliasName - o.Expression = all.Expression + o.Expression = *all.Expression if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_timeseries_widget_request.go b/api/datadogV1/model_timeseries_widget_request.go index dc030c3aa38..97465db689b 100644 --- a/api/datadogV1/model_timeseries_widget_request.go +++ b/api/datadogV1/model_timeseries_widget_request.go @@ -630,8 +630,7 @@ func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` Style *WidgetRequestStyle `json:"style,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_toplist_widget_definition.go b/api/datadogV1/model_toplist_widget_definition.go index 6b71a856891..8519d86f2bf 100644 --- a/api/datadogV1/model_toplist_widget_definition.go +++ b/api/datadogV1/model_toplist_widget_definition.go @@ -272,31 +272,16 @@ func (o ToplistWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]ToplistWidgetRequest `json:"requests"` - Type *ToplistWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []ToplistWidgetRequest `json:"requests"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type ToplistWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests *[]ToplistWidgetRequest `json:"requests"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *ToplistWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -304,6 +289,12 @@ func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "requests", "time", "title", "title_align", "title_size", "type"}) @@ -327,7 +318,7 @@ func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.CustomLinks = all.CustomLinks - o.Requests = all.Requests + o.Requests = *all.Requests if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -339,7 +330,7 @@ func (o *ToplistWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_toplist_widget_request.go b/api/datadogV1/model_toplist_widget_request.go index 4c1a7555f0d..d5fe8285634 100644 --- a/api/datadogV1/model_toplist_widget_request.go +++ b/api/datadogV1/model_toplist_widget_request.go @@ -562,8 +562,7 @@ func (o *ToplistWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` Style *WidgetRequestStyle `json:"style,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_topology_map_widget_definition.go b/api/datadogV1/model_topology_map_widget_definition.go index 17f66a45b27..84df583e5c9 100644 --- a/api/datadogV1/model_topology_map_widget_definition.go +++ b/api/datadogV1/model_topology_map_widget_definition.go @@ -239,30 +239,15 @@ func (o TopologyMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TopologyMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]TopologyRequest `json:"requests"` - Type *TopologyMapWidgetDefinitionType `json:"type"` - }{} all := struct { - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - Requests []TopologyRequest `json:"requests"` - Title *string `json:"title,omitempty"` - TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` - TitleSize *string `json:"title_size,omitempty"` - Type TopologyMapWidgetDefinitionType `json:"type"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + Requests *[]TopologyRequest `json:"requests"` + Title *string `json:"title,omitempty"` + TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` + TitleSize *string `json:"title_size,omitempty"` + Type *TopologyMapWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -270,6 +255,12 @@ func (o *TopologyMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "requests", "title", "title_align", "title_size", "type"}) @@ -293,11 +284,11 @@ func (o *TopologyMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { return nil } o.CustomLinks = all.CustomLinks - o.Requests = all.Requests + o.Requests = *all.Requests o.Title = all.Title o.TitleAlign = all.TitleAlign o.TitleSize = all.TitleSize - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_topology_query.go b/api/datadogV1/model_topology_query.go index 0382c1a2c1f..bc0cf92f95b 100644 --- a/api/datadogV1/model_topology_query.go +++ b/api/datadogV1/model_topology_query.go @@ -154,8 +154,7 @@ func (o *TopologyQuery) UnmarshalJSON(bytes []byte) (err error) { Filters []string `json:"filters,omitempty"` Service *string `json:"service,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_topology_request.go b/api/datadogV1/model_topology_request.go index 0c23c2394f5..3278ab413d6 100644 --- a/api/datadogV1/model_topology_request.go +++ b/api/datadogV1/model_topology_request.go @@ -120,8 +120,7 @@ func (o *TopologyRequest) UnmarshalJSON(bytes []byte) (err error) { Query *TopologyQuery `json:"query,omitempty"` RequestType *TopologyRequestType `json:"request_type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_tree_map_widget_definition.go b/api/datadogV1/model_tree_map_widget_definition.go index f326c7c437c..14047f0e3fc 100644 --- a/api/datadogV1/model_tree_map_widget_definition.go +++ b/api/datadogV1/model_tree_map_widget_definition.go @@ -321,32 +321,17 @@ func (o TreeMapWidgetDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Requests *[]TreeMapWidgetRequest `json:"requests"` - Type *TreeMapWidgetDefinitionType `json:"type"` - }{} all := struct { - ColorBy *TreeMapColorBy `json:"color_by,omitempty"` - CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` - GroupBy *TreeMapGroupBy `json:"group_by,omitempty"` - Requests []TreeMapWidgetRequest `json:"requests"` - SizeBy *TreeMapSizeBy `json:"size_by,omitempty"` - Time *WidgetTime `json:"time,omitempty"` - Title *string `json:"title,omitempty"` - Type TreeMapWidgetDefinitionType `json:"type"` + ColorBy *TreeMapColorBy `json:"color_by,omitempty"` + CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` + GroupBy *TreeMapGroupBy `json:"group_by,omitempty"` + Requests *[]TreeMapWidgetRequest `json:"requests"` + SizeBy *TreeMapSizeBy `json:"size_by,omitempty"` + Time *WidgetTime `json:"time,omitempty"` + Title *string `json:"title,omitempty"` + Type *TreeMapWidgetDefinitionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Requests == nil { - return fmt.Errorf("required field requests missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -354,6 +339,12 @@ func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Requests == nil { + return fmt.Errorf("required field requests missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"color_by", "custom_links", "group_by", "requests", "size_by", "time", "title", "type"}) @@ -395,7 +386,7 @@ func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.ColorBy = all.ColorBy o.CustomLinks = all.CustomLinks o.GroupBy = all.GroupBy - o.Requests = all.Requests + o.Requests = *all.Requests o.SizeBy = all.SizeBy if all.Time != nil && all.Time.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) @@ -406,7 +397,7 @@ func (o *TreeMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.Time = all.Time o.Title = all.Title - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_tree_map_widget_request.go b/api/datadogV1/model_tree_map_widget_request.go index b9b8789102c..e8f3ecda2c7 100644 --- a/api/datadogV1/model_tree_map_widget_request.go +++ b/api/datadogV1/model_tree_map_widget_request.go @@ -188,8 +188,7 @@ func (o *TreeMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_analyzed_logs_hour.go b/api/datadogV1/model_usage_analyzed_logs_hour.go index bea77e0832d..1cdc3d82c37 100644 --- a/api/datadogV1/model_usage_analyzed_logs_hour.go +++ b/api/datadogV1/model_usage_analyzed_logs_hour.go @@ -204,8 +204,7 @@ func (o *UsageAnalyzedLogsHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_analyzed_logs_response.go b/api/datadogV1/model_usage_analyzed_logs_response.go index 93df9ba7584..ae1dc39101e 100644 --- a/api/datadogV1/model_usage_analyzed_logs_response.go +++ b/api/datadogV1/model_usage_analyzed_logs_response.go @@ -86,8 +86,7 @@ func (o *UsageAnalyzedLogsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageAnalyzedLogsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_attribution_aggregates_body.go b/api/datadogV1/model_usage_attribution_aggregates_body.go index 230d2371ff1..250c2f310d1 100644 --- a/api/datadogV1/model_usage_attribution_aggregates_body.go +++ b/api/datadogV1/model_usage_attribution_aggregates_body.go @@ -154,8 +154,7 @@ func (o *UsageAttributionAggregatesBody) UnmarshalJSON(bytes []byte) (err error) Field *string `json:"field,omitempty"` Value *float64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_attribution_body.go b/api/datadogV1/model_usage_attribution_body.go index a08a6a96af1..1b99efdc7e7 100644 --- a/api/datadogV1/model_usage_attribution_body.go +++ b/api/datadogV1/model_usage_attribution_body.go @@ -300,8 +300,7 @@ func (o *UsageAttributionBody) UnmarshalJSON(bytes []byte) (err error) { UpdatedAt *string `json:"updated_at,omitempty"` Values *UsageAttributionValues `json:"values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_attribution_metadata.go b/api/datadogV1/model_usage_attribution_metadata.go index 09aba10eaae..5c919ca6699 100644 --- a/api/datadogV1/model_usage_attribution_metadata.go +++ b/api/datadogV1/model_usage_attribution_metadata.go @@ -120,8 +120,7 @@ func (o *UsageAttributionMetadata) UnmarshalJSON(bytes []byte) (err error) { Aggregates []UsageAttributionAggregatesBody `json:"aggregates,omitempty"` Pagination *UsageAttributionPagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_attribution_pagination.go b/api/datadogV1/model_usage_attribution_pagination.go index b6bebbcdf43..ccd7c228dd4 100644 --- a/api/datadogV1/model_usage_attribution_pagination.go +++ b/api/datadogV1/model_usage_attribution_pagination.go @@ -222,8 +222,7 @@ func (o *UsageAttributionPagination) UnmarshalJSON(bytes []byte) (err error) { SortName *string `json:"sort_name,omitempty"` TotalNumberOfRecords *int64 `json:"total_number_of_records,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_attribution_response.go b/api/datadogV1/model_usage_attribution_response.go index 4d5f63dca95..397f23bbef6 100644 --- a/api/datadogV1/model_usage_attribution_response.go +++ b/api/datadogV1/model_usage_attribution_response.go @@ -120,8 +120,7 @@ func (o *UsageAttributionResponse) UnmarshalJSON(bytes []byte) (err error) { Metadata *UsageAttributionMetadata `json:"metadata,omitempty"` Usage []UsageAttributionBody `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_attribution_values.go b/api/datadogV1/model_usage_attribution_values.go index ce3afaca118..3006d565bb3 100644 --- a/api/datadogV1/model_usage_attribution_values.go +++ b/api/datadogV1/model_usage_attribution_values.go @@ -1820,8 +1820,7 @@ func (o *UsageAttributionValues) UnmarshalJSON(bytes []byte) (err error) { SnmpPercentage *float64 `json:"snmp_percentage,omitempty"` SnmpUsage *float64 `json:"snmp_usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_audit_logs_hour.go b/api/datadogV1/model_usage_audit_logs_hour.go index fb2d03cf285..b18efe6c4e2 100644 --- a/api/datadogV1/model_usage_audit_logs_hour.go +++ b/api/datadogV1/model_usage_audit_logs_hour.go @@ -204,8 +204,7 @@ func (o *UsageAuditLogsHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_audit_logs_response.go b/api/datadogV1/model_usage_audit_logs_response.go index bd7dec85d84..a34d31ff614 100644 --- a/api/datadogV1/model_usage_audit_logs_response.go +++ b/api/datadogV1/model_usage_audit_logs_response.go @@ -86,8 +86,7 @@ func (o *UsageAuditLogsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageAuditLogsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_billable_summary_body.go b/api/datadogV1/model_usage_billable_summary_body.go index c715246a0a0..987c16f3457 100644 --- a/api/datadogV1/model_usage_billable_summary_body.go +++ b/api/datadogV1/model_usage_billable_summary_body.go @@ -299,8 +299,7 @@ func (o *UsageBillableSummaryBody) UnmarshalJSON(bytes []byte) (err error) { PercentageInAccount *float64 `json:"percentage_in_account,omitempty"` UsageUnit *string `json:"usage_unit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_billable_summary_hour.go b/api/datadogV1/model_usage_billable_summary_hour.go index 2b80e66b72d..f74c41994e0 100644 --- a/api/datadogV1/model_usage_billable_summary_hour.go +++ b/api/datadogV1/model_usage_billable_summary_hour.go @@ -367,8 +367,7 @@ func (o *UsageBillableSummaryHour) UnmarshalJSON(bytes []byte) (err error) { StartDate *time.Time `json:"start_date,omitempty"` Usage *UsageBillableSummaryKeys `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_billable_summary_keys.go b/api/datadogV1/model_usage_billable_summary_keys.go index 65b7b815042..62c8509fa3b 100644 --- a/api/datadogV1/model_usage_billable_summary_keys.go +++ b/api/datadogV1/model_usage_billable_summary_keys.go @@ -3044,8 +3044,7 @@ func (o *UsageBillableSummaryKeys) UnmarshalJSON(bytes []byte) (err error) { TimeseriesAverage *UsageBillableSummaryBody `json:"timeseries_average,omitempty"` TimeseriesSum *UsageBillableSummaryBody `json:"timeseries_sum,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_billable_summary_response.go b/api/datadogV1/model_usage_billable_summary_response.go index 41d7bac19ae..7d912614e0e 100644 --- a/api/datadogV1/model_usage_billable_summary_response.go +++ b/api/datadogV1/model_usage_billable_summary_response.go @@ -86,8 +86,7 @@ func (o *UsageBillableSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageBillableSummaryHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_ci_visibility_hour.go b/api/datadogV1/model_usage_ci_visibility_hour.go index 7e58f1b68c2..e02ef37763f 100644 --- a/api/datadogV1/model_usage_ci_visibility_hour.go +++ b/api/datadogV1/model_usage_ci_visibility_hour.go @@ -300,8 +300,7 @@ func (o *UsageCIVisibilityHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_ci_visibility_response.go b/api/datadogV1/model_usage_ci_visibility_response.go index 3570fcd7c4c..68728a73ea7 100644 --- a/api/datadogV1/model_usage_ci_visibility_response.go +++ b/api/datadogV1/model_usage_ci_visibility_response.go @@ -86,8 +86,7 @@ func (o *UsageCIVisibilityResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageCIVisibilityHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_cloud_security_posture_management_hour.go b/api/datadogV1/model_usage_cloud_security_posture_management_hour.go index d7569ee4b24..d74b5e47b43 100644 --- a/api/datadogV1/model_usage_cloud_security_posture_management_hour.go +++ b/api/datadogV1/model_usage_cloud_security_posture_management_hour.go @@ -474,8 +474,7 @@ func (o *UsageCloudSecurityPostureManagementHour) UnmarshalJSON(bytes []byte) (e OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_cloud_security_posture_management_response.go b/api/datadogV1/model_usage_cloud_security_posture_management_response.go index f400037aee3..6c560ceb3d4 100644 --- a/api/datadogV1/model_usage_cloud_security_posture_management_response.go +++ b/api/datadogV1/model_usage_cloud_security_posture_management_response.go @@ -86,8 +86,7 @@ func (o *UsageCloudSecurityPostureManagementResponse) UnmarshalJSON(bytes []byte all := struct { Usage []UsageCloudSecurityPostureManagementHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_custom_reports_attributes.go b/api/datadogV1/model_usage_custom_reports_attributes.go index f5592a4d897..ef2a1b27107 100644 --- a/api/datadogV1/model_usage_custom_reports_attributes.go +++ b/api/datadogV1/model_usage_custom_reports_attributes.go @@ -222,8 +222,7 @@ func (o *UsageCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err error) { StartDate *string `json:"start_date,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_custom_reports_data.go b/api/datadogV1/model_usage_custom_reports_data.go index 69837ec1f1c..767018b95bf 100644 --- a/api/datadogV1/model_usage_custom_reports_data.go +++ b/api/datadogV1/model_usage_custom_reports_data.go @@ -158,8 +158,7 @@ func (o *UsageCustomReportsData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *UsageReportsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_custom_reports_meta.go b/api/datadogV1/model_usage_custom_reports_meta.go index 6070fae254d..7d39c345042 100644 --- a/api/datadogV1/model_usage_custom_reports_meta.go +++ b/api/datadogV1/model_usage_custom_reports_meta.go @@ -86,8 +86,7 @@ func (o *UsageCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *UsageCustomReportsPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_custom_reports_page.go b/api/datadogV1/model_usage_custom_reports_page.go index 199f721ad30..d5845948fdd 100644 --- a/api/datadogV1/model_usage_custom_reports_page.go +++ b/api/datadogV1/model_usage_custom_reports_page.go @@ -86,8 +86,7 @@ func (o *UsageCustomReportsPage) UnmarshalJSON(bytes []byte) (err error) { all := struct { TotalCount *int64 `json:"total_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_custom_reports_response.go b/api/datadogV1/model_usage_custom_reports_response.go index 5f4e49da180..814c0bbf412 100644 --- a/api/datadogV1/model_usage_custom_reports_response.go +++ b/api/datadogV1/model_usage_custom_reports_response.go @@ -120,8 +120,7 @@ func (o *UsageCustomReportsResponse) UnmarshalJSON(bytes []byte) (err error) { Data []UsageCustomReportsData `json:"data,omitempty"` Meta *UsageCustomReportsMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_cws_hour.go b/api/datadogV1/model_usage_cws_hour.go index bdfe2754ae0..5ac2a1d1542 100644 --- a/api/datadogV1/model_usage_cws_hour.go +++ b/api/datadogV1/model_usage_cws_hour.go @@ -249,8 +249,7 @@ func (o *UsageCWSHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_cws_response.go b/api/datadogV1/model_usage_cws_response.go index 53bd7512667..abec2833667 100644 --- a/api/datadogV1/model_usage_cws_response.go +++ b/api/datadogV1/model_usage_cws_response.go @@ -86,8 +86,7 @@ func (o *UsageCWSResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageCWSHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_dbm_hour.go b/api/datadogV1/model_usage_dbm_hour.go index 24d41bc4676..a528059f67c 100644 --- a/api/datadogV1/model_usage_dbm_hour.go +++ b/api/datadogV1/model_usage_dbm_hour.go @@ -249,8 +249,7 @@ func (o *UsageDBMHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_dbm_response.go b/api/datadogV1/model_usage_dbm_response.go index df4b53198ea..05e2284c21c 100644 --- a/api/datadogV1/model_usage_dbm_response.go +++ b/api/datadogV1/model_usage_dbm_response.go @@ -86,8 +86,7 @@ func (o *UsageDBMResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageDBMHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_fargate_hour.go b/api/datadogV1/model_usage_fargate_hour.go index 7718e560121..52ec10b93c2 100644 --- a/api/datadogV1/model_usage_fargate_hour.go +++ b/api/datadogV1/model_usage_fargate_hour.go @@ -339,8 +339,7 @@ func (o *UsageFargateHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` TasksCount datadog.NullableInt64 `json:"tasks_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_fargate_response.go b/api/datadogV1/model_usage_fargate_response.go index e82715400d8..5bff7dcc4d1 100644 --- a/api/datadogV1/model_usage_fargate_response.go +++ b/api/datadogV1/model_usage_fargate_response.go @@ -86,8 +86,7 @@ func (o *UsageFargateResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageFargateHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_host_hour.go b/api/datadogV1/model_usage_host_hour.go index 2264efc1d18..e20954a7dba 100644 --- a/api/datadogV1/model_usage_host_hour.go +++ b/api/datadogV1/model_usage_host_hour.go @@ -805,8 +805,7 @@ func (o *UsageHostHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` VsphereHostCount datadog.NullableInt64 `json:"vsphere_host_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_hosts_response.go b/api/datadogV1/model_usage_hosts_response.go index 1bb5cc9c96a..14d027645f8 100644 --- a/api/datadogV1/model_usage_hosts_response.go +++ b/api/datadogV1/model_usage_hosts_response.go @@ -86,8 +86,7 @@ func (o *UsageHostsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageHostHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_incident_management_hour.go b/api/datadogV1/model_usage_incident_management_hour.go index fd015855990..05a1c2afcc5 100644 --- a/api/datadogV1/model_usage_incident_management_hour.go +++ b/api/datadogV1/model_usage_incident_management_hour.go @@ -204,8 +204,7 @@ func (o *UsageIncidentManagementHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_incident_management_response.go b/api/datadogV1/model_usage_incident_management_response.go index 929576f65cb..7810d903c5f 100644 --- a/api/datadogV1/model_usage_incident_management_response.go +++ b/api/datadogV1/model_usage_incident_management_response.go @@ -86,8 +86,7 @@ func (o *UsageIncidentManagementResponse) UnmarshalJSON(bytes []byte) (err error all := struct { Usage []UsageIncidentManagementHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_indexed_spans_hour.go b/api/datadogV1/model_usage_indexed_spans_hour.go index 5ead88f490e..ba0928ba96c 100644 --- a/api/datadogV1/model_usage_indexed_spans_hour.go +++ b/api/datadogV1/model_usage_indexed_spans_hour.go @@ -204,8 +204,7 @@ func (o *UsageIndexedSpansHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_indexed_spans_response.go b/api/datadogV1/model_usage_indexed_spans_response.go index ff220c70718..be75ca942ce 100644 --- a/api/datadogV1/model_usage_indexed_spans_response.go +++ b/api/datadogV1/model_usage_indexed_spans_response.go @@ -86,8 +86,7 @@ func (o *UsageIndexedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageIndexedSpansHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_ingested_spans_hour.go b/api/datadogV1/model_usage_ingested_spans_hour.go index ef368c0d212..18248345057 100644 --- a/api/datadogV1/model_usage_ingested_spans_hour.go +++ b/api/datadogV1/model_usage_ingested_spans_hour.go @@ -204,8 +204,7 @@ func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_ingested_spans_response.go b/api/datadogV1/model_usage_ingested_spans_response.go index d6c2de2e785..532ad85c0ff 100644 --- a/api/datadogV1/model_usage_ingested_spans_response.go +++ b/api/datadogV1/model_usage_ingested_spans_response.go @@ -86,8 +86,7 @@ func (o *UsageIngestedSpansResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageIngestedSpansHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_io_t_hour.go b/api/datadogV1/model_usage_io_t_hour.go index 2deffadf3c4..bff6d7abccd 100644 --- a/api/datadogV1/model_usage_io_t_hour.go +++ b/api/datadogV1/model_usage_io_t_hour.go @@ -204,8 +204,7 @@ func (o *UsageIoTHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_io_t_response.go b/api/datadogV1/model_usage_io_t_response.go index 8f2c816b2bf..0e593c99bdd 100644 --- a/api/datadogV1/model_usage_io_t_response.go +++ b/api/datadogV1/model_usage_io_t_response.go @@ -86,8 +86,7 @@ func (o *UsageIoTResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageIoTHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_lambda_hour.go b/api/datadogV1/model_usage_lambda_hour.go index 48cc7bf8439..48a9652c8ea 100644 --- a/api/datadogV1/model_usage_lambda_hour.go +++ b/api/datadogV1/model_usage_lambda_hour.go @@ -250,8 +250,7 @@ func (o *UsageLambdaHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_lambda_response.go b/api/datadogV1/model_usage_lambda_response.go index 05c5b513f0a..319a13dbc99 100644 --- a/api/datadogV1/model_usage_lambda_response.go +++ b/api/datadogV1/model_usage_lambda_response.go @@ -87,8 +87,7 @@ func (o *UsageLambdaResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageLambdaHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_logs_by_index_hour.go b/api/datadogV1/model_usage_logs_by_index_hour.go index 59d53743973..b9af299adfe 100644 --- a/api/datadogV1/model_usage_logs_by_index_hour.go +++ b/api/datadogV1/model_usage_logs_by_index_hour.go @@ -295,8 +295,7 @@ func (o *UsageLogsByIndexHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` Retention *int64 `json:"retention,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_logs_by_index_response.go b/api/datadogV1/model_usage_logs_by_index_response.go index 07d2bd00b14..19de4113fa6 100644 --- a/api/datadogV1/model_usage_logs_by_index_response.go +++ b/api/datadogV1/model_usage_logs_by_index_response.go @@ -86,8 +86,7 @@ func (o *UsageLogsByIndexResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageLogsByIndexHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_logs_by_retention_hour.go b/api/datadogV1/model_usage_logs_by_retention_hour.go index 6c5647903da..a02c0c5ae50 100644 --- a/api/datadogV1/model_usage_logs_by_retention_hour.go +++ b/api/datadogV1/model_usage_logs_by_retention_hour.go @@ -300,8 +300,7 @@ func (o *UsageLogsByRetentionHour) UnmarshalJSON(bytes []byte) (err error) { RehydratedIndexedEventsCount datadog.NullableInt64 `json:"rehydrated_indexed_events_count,omitempty"` Retention datadog.NullableString `json:"retention,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_logs_by_retention_response.go b/api/datadogV1/model_usage_logs_by_retention_response.go index 97d83acbb19..4b7abada561 100644 --- a/api/datadogV1/model_usage_logs_by_retention_response.go +++ b/api/datadogV1/model_usage_logs_by_retention_response.go @@ -86,8 +86,7 @@ func (o *UsageLogsByRetentionResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageLogsByRetentionHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_logs_hour.go b/api/datadogV1/model_usage_logs_hour.go index eff4d6f4a8e..846c5d0ee8e 100644 --- a/api/datadogV1/model_usage_logs_hour.go +++ b/api/datadogV1/model_usage_logs_hour.go @@ -519,8 +519,7 @@ func (o *UsageLogsHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_logs_response.go b/api/datadogV1/model_usage_logs_response.go index bc1f70c675c..32556942122 100644 --- a/api/datadogV1/model_usage_logs_response.go +++ b/api/datadogV1/model_usage_logs_response.go @@ -86,8 +86,7 @@ func (o *UsageLogsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageLogsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_network_flows_hour.go b/api/datadogV1/model_usage_network_flows_hour.go index 6059dd9958d..6522ece01c2 100644 --- a/api/datadogV1/model_usage_network_flows_hour.go +++ b/api/datadogV1/model_usage_network_flows_hour.go @@ -204,8 +204,7 @@ func (o *UsageNetworkFlowsHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_network_flows_response.go b/api/datadogV1/model_usage_network_flows_response.go index 0ce32de6b5f..9803e0a6bf7 100644 --- a/api/datadogV1/model_usage_network_flows_response.go +++ b/api/datadogV1/model_usage_network_flows_response.go @@ -86,8 +86,7 @@ func (o *UsageNetworkFlowsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageNetworkFlowsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_network_hosts_hour.go b/api/datadogV1/model_usage_network_hosts_hour.go index dc6cb44e30f..0b7897ccfe0 100644 --- a/api/datadogV1/model_usage_network_hosts_hour.go +++ b/api/datadogV1/model_usage_network_hosts_hour.go @@ -204,8 +204,7 @@ func (o *UsageNetworkHostsHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_network_hosts_response.go b/api/datadogV1/model_usage_network_hosts_response.go index 8a024aaeb34..95e2c7a138c 100644 --- a/api/datadogV1/model_usage_network_hosts_response.go +++ b/api/datadogV1/model_usage_network_hosts_response.go @@ -86,8 +86,7 @@ func (o *UsageNetworkHostsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageNetworkHostsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_online_archive_hour.go b/api/datadogV1/model_usage_online_archive_hour.go index 1dead907820..353d9bd1423 100644 --- a/api/datadogV1/model_usage_online_archive_hour.go +++ b/api/datadogV1/model_usage_online_archive_hour.go @@ -204,8 +204,7 @@ func (o *UsageOnlineArchiveHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_online_archive_response.go b/api/datadogV1/model_usage_online_archive_response.go index 07a457a2c5d..e54fafabf9f 100644 --- a/api/datadogV1/model_usage_online_archive_response.go +++ b/api/datadogV1/model_usage_online_archive_response.go @@ -86,8 +86,7 @@ func (o *UsageOnlineArchiveResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageOnlineArchiveHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_profiling_hour.go b/api/datadogV1/model_usage_profiling_hour.go index ce74dc8e895..0774a5a6c86 100644 --- a/api/datadogV1/model_usage_profiling_hour.go +++ b/api/datadogV1/model_usage_profiling_hour.go @@ -249,8 +249,7 @@ func (o *UsageProfilingHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_profiling_response.go b/api/datadogV1/model_usage_profiling_response.go index 746810637cd..0f3b2c72f2d 100644 --- a/api/datadogV1/model_usage_profiling_response.go +++ b/api/datadogV1/model_usage_profiling_response.go @@ -86,8 +86,7 @@ func (o *UsageProfilingResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageProfilingHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_rum_sessions_hour.go b/api/datadogV1/model_usage_rum_sessions_hour.go index 8245466eec0..bb0484856fe 100644 --- a/api/datadogV1/model_usage_rum_sessions_hour.go +++ b/api/datadogV1/model_usage_rum_sessions_hour.go @@ -418,8 +418,7 @@ func (o *UsageRumSessionsHour) UnmarshalJSON(bytes []byte) (err error) { SessionCountIos datadog.NullableInt64 `json:"session_count_ios,omitempty"` SessionCountReactnative datadog.NullableInt64 `json:"session_count_reactnative,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_rum_sessions_response.go b/api/datadogV1/model_usage_rum_sessions_response.go index e3a86e57331..caa2a4c0bf5 100644 --- a/api/datadogV1/model_usage_rum_sessions_response.go +++ b/api/datadogV1/model_usage_rum_sessions_response.go @@ -86,8 +86,7 @@ func (o *UsageRumSessionsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageRumSessionsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_rum_units_hour.go b/api/datadogV1/model_usage_rum_units_hour.go index 76e9622c838..2fc1047e7a3 100644 --- a/api/datadogV1/model_usage_rum_units_hour.go +++ b/api/datadogV1/model_usage_rum_units_hour.go @@ -255,8 +255,7 @@ func (o *UsageRumUnitsHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` RumUnits datadog.NullableInt64 `json:"rum_units,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_rum_units_response.go b/api/datadogV1/model_usage_rum_units_response.go index e1ba7684d6a..459ff0052b0 100644 --- a/api/datadogV1/model_usage_rum_units_response.go +++ b/api/datadogV1/model_usage_rum_units_response.go @@ -86,8 +86,7 @@ func (o *UsageRumUnitsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageRumUnitsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_sds_hour.go b/api/datadogV1/model_usage_sds_hour.go index a481d0b9675..d4a9b4d8b36 100644 --- a/api/datadogV1/model_usage_sds_hour.go +++ b/api/datadogV1/model_usage_sds_hour.go @@ -384,8 +384,7 @@ func (o *UsageSDSHour) UnmarshalJSON(bytes []byte) (err error) { RumScannedBytes datadog.NullableInt64 `json:"rum_scanned_bytes,omitempty"` TotalScannedBytes datadog.NullableInt64 `json:"total_scanned_bytes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_sds_response.go b/api/datadogV1/model_usage_sds_response.go index 3f4ec16ee13..d91b586645b 100644 --- a/api/datadogV1/model_usage_sds_response.go +++ b/api/datadogV1/model_usage_sds_response.go @@ -86,8 +86,7 @@ func (o *UsageSDSResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageSDSHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_snmp_hour.go b/api/datadogV1/model_usage_snmp_hour.go index c1f83e716b2..f607c19587b 100644 --- a/api/datadogV1/model_usage_snmp_hour.go +++ b/api/datadogV1/model_usage_snmp_hour.go @@ -204,8 +204,7 @@ func (o *UsageSNMPHour) UnmarshalJSON(bytes []byte) (err error) { PublicId *string `json:"public_id,omitempty"` SnmpDevices datadog.NullableInt64 `json:"snmp_devices,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_snmp_response.go b/api/datadogV1/model_usage_snmp_response.go index 16871591618..16ae408f6d5 100644 --- a/api/datadogV1/model_usage_snmp_response.go +++ b/api/datadogV1/model_usage_snmp_response.go @@ -86,8 +86,7 @@ func (o *UsageSNMPResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageSNMPHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_specified_custom_reports_attributes.go b/api/datadogV1/model_usage_specified_custom_reports_attributes.go index be9d7382070..20dbee8d6c2 100644 --- a/api/datadogV1/model_usage_specified_custom_reports_attributes.go +++ b/api/datadogV1/model_usage_specified_custom_reports_attributes.go @@ -256,8 +256,7 @@ func (o *UsageSpecifiedCustomReportsAttributes) UnmarshalJSON(bytes []byte) (err StartDate *string `json:"start_date,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_specified_custom_reports_data.go b/api/datadogV1/model_usage_specified_custom_reports_data.go index 8d99f614015..6f2b9205f41 100644 --- a/api/datadogV1/model_usage_specified_custom_reports_data.go +++ b/api/datadogV1/model_usage_specified_custom_reports_data.go @@ -158,8 +158,7 @@ func (o *UsageSpecifiedCustomReportsData) UnmarshalJSON(bytes []byte) (err error Id *string `json:"id,omitempty"` Type *UsageReportsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_specified_custom_reports_meta.go b/api/datadogV1/model_usage_specified_custom_reports_meta.go index fe51d07d868..648877b4b18 100644 --- a/api/datadogV1/model_usage_specified_custom_reports_meta.go +++ b/api/datadogV1/model_usage_specified_custom_reports_meta.go @@ -86,8 +86,7 @@ func (o *UsageSpecifiedCustomReportsMeta) UnmarshalJSON(bytes []byte) (err error all := struct { Page *UsageSpecifiedCustomReportsPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_specified_custom_reports_page.go b/api/datadogV1/model_usage_specified_custom_reports_page.go index d8aa623a01d..b585a221e9e 100644 --- a/api/datadogV1/model_usage_specified_custom_reports_page.go +++ b/api/datadogV1/model_usage_specified_custom_reports_page.go @@ -86,8 +86,7 @@ func (o *UsageSpecifiedCustomReportsPage) UnmarshalJSON(bytes []byte) (err error all := struct { TotalCount *int64 `json:"total_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_specified_custom_reports_response.go b/api/datadogV1/model_usage_specified_custom_reports_response.go index 0dabd89cf42..82ae25ea093 100644 --- a/api/datadogV1/model_usage_specified_custom_reports_response.go +++ b/api/datadogV1/model_usage_specified_custom_reports_response.go @@ -120,8 +120,7 @@ func (o *UsageSpecifiedCustomReportsResponse) UnmarshalJSON(bytes []byte) (err e Data *UsageSpecifiedCustomReportsData `json:"data,omitempty"` Meta *UsageSpecifiedCustomReportsMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_summary_date.go b/api/datadogV1/model_usage_summary_date.go index dec6418ba13..aaf21de0628 100644 --- a/api/datadogV1/model_usage_summary_date.go +++ b/api/datadogV1/model_usage_summary_date.go @@ -2883,8 +2883,7 @@ func (o *UsageSummaryDate) UnmarshalJSON(bytes []byte) (err error) { VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` VulnManagementHostCountTop99p *int64 `json:"vuln_management_host_count_top99p,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_summary_date_org.go b/api/datadogV1/model_usage_summary_date_org.go index 0e683bca6bc..add113eb386 100644 --- a/api/datadogV1/model_usage_summary_date_org.go +++ b/api/datadogV1/model_usage_summary_date_org.go @@ -2946,8 +2946,7 @@ func (o *UsageSummaryDateOrg) UnmarshalJSON(bytes []byte) (err error) { VsphereHostTop99p *int64 `json:"vsphere_host_top99p,omitempty"` VulnManagementHostCountTop99p *int64 `json:"vuln_management_host_count_top99p,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_summary_response.go b/api/datadogV1/model_usage_summary_response.go index 87437933333..2f5fc2d32fc 100644 --- a/api/datadogV1/model_usage_summary_response.go +++ b/api/datadogV1/model_usage_summary_response.go @@ -3197,8 +3197,7 @@ func (o *UsageSummaryResponse) UnmarshalJSON(bytes []byte) (err error) { VsphereHostTop99pSum *int64 `json:"vsphere_host_top99p_sum,omitempty"` VulnManagementHostCountTop99pSum *int64 `json:"vuln_management_host_count_top99p_sum,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_synthetics_api_hour.go b/api/datadogV1/model_usage_synthetics_api_hour.go index 937250a24f1..ddaa6aecddc 100644 --- a/api/datadogV1/model_usage_synthetics_api_hour.go +++ b/api/datadogV1/model_usage_synthetics_api_hour.go @@ -204,8 +204,7 @@ func (o *UsageSyntheticsAPIHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_synthetics_api_response.go b/api/datadogV1/model_usage_synthetics_api_response.go index e3648e81e89..248d7760b8a 100644 --- a/api/datadogV1/model_usage_synthetics_api_response.go +++ b/api/datadogV1/model_usage_synthetics_api_response.go @@ -86,8 +86,7 @@ func (o *UsageSyntheticsAPIResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageSyntheticsAPIHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_synthetics_browser_hour.go b/api/datadogV1/model_usage_synthetics_browser_hour.go index 664c528ede7..ca17939724b 100644 --- a/api/datadogV1/model_usage_synthetics_browser_hour.go +++ b/api/datadogV1/model_usage_synthetics_browser_hour.go @@ -204,8 +204,7 @@ func (o *UsageSyntheticsBrowserHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_synthetics_browser_response.go b/api/datadogV1/model_usage_synthetics_browser_response.go index 96a28756134..1e6b3a06053 100644 --- a/api/datadogV1/model_usage_synthetics_browser_response.go +++ b/api/datadogV1/model_usage_synthetics_browser_response.go @@ -86,8 +86,7 @@ func (o *UsageSyntheticsBrowserResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Usage []UsageSyntheticsBrowserHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_synthetics_hour.go b/api/datadogV1/model_usage_synthetics_hour.go index 4696b51e6a5..8cad4772225 100644 --- a/api/datadogV1/model_usage_synthetics_hour.go +++ b/api/datadogV1/model_usage_synthetics_hour.go @@ -193,8 +193,7 @@ func (o *UsageSyntheticsHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_synthetics_response.go b/api/datadogV1/model_usage_synthetics_response.go index fc4c3e66f78..2bd1abb0d3b 100644 --- a/api/datadogV1/model_usage_synthetics_response.go +++ b/api/datadogV1/model_usage_synthetics_response.go @@ -86,8 +86,7 @@ func (o *UsageSyntheticsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageSyntheticsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_timeseries_hour.go b/api/datadogV1/model_usage_timeseries_hour.go index 6b999c5093c..f28a074e600 100644 --- a/api/datadogV1/model_usage_timeseries_hour.go +++ b/api/datadogV1/model_usage_timeseries_hour.go @@ -261,8 +261,7 @@ func (o *UsageTimeseriesHour) UnmarshalJSON(bytes []byte) (err error) { OrgName *string `json:"org_name,omitempty"` PublicId *string `json:"public_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_timeseries_response.go b/api/datadogV1/model_usage_timeseries_response.go index 55f8f3f2a07..44aa7d4132c 100644 --- a/api/datadogV1/model_usage_timeseries_response.go +++ b/api/datadogV1/model_usage_timeseries_response.go @@ -86,8 +86,7 @@ func (o *UsageTimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Usage []UsageTimeseriesHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_top_avg_metrics_hour.go b/api/datadogV1/model_usage_top_avg_metrics_hour.go index f5a682b9bd4..013910bcc87 100644 --- a/api/datadogV1/model_usage_top_avg_metrics_hour.go +++ b/api/datadogV1/model_usage_top_avg_metrics_hour.go @@ -188,8 +188,7 @@ func (o *UsageTopAvgMetricsHour) UnmarshalJSON(bytes []byte) (err error) { MetricCategory *UsageMetricCategory `json:"metric_category,omitempty"` MetricName *string `json:"metric_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_top_avg_metrics_metadata.go b/api/datadogV1/model_usage_top_avg_metrics_metadata.go index 1d907ba43b7..60cba71d30a 100644 --- a/api/datadogV1/model_usage_top_avg_metrics_metadata.go +++ b/api/datadogV1/model_usage_top_avg_metrics_metadata.go @@ -163,8 +163,7 @@ func (o *UsageTopAvgMetricsMetadata) UnmarshalJSON(bytes []byte) (err error) { Month *time.Time `json:"month,omitempty"` Pagination *UsageTopAvgMetricsPagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_top_avg_metrics_pagination.go b/api/datadogV1/model_usage_top_avg_metrics_pagination.go index 07e8bf2f686..3bab83b591b 100644 --- a/api/datadogV1/model_usage_top_avg_metrics_pagination.go +++ b/api/datadogV1/model_usage_top_avg_metrics_pagination.go @@ -176,8 +176,7 @@ func (o *UsageTopAvgMetricsPagination) UnmarshalJSON(bytes []byte) (err error) { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` TotalNumberOfRecords datadog.NullableInt64 `json:"total_number_of_records,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_usage_top_avg_metrics_response.go b/api/datadogV1/model_usage_top_avg_metrics_response.go index c47db450d01..99465f226ce 100644 --- a/api/datadogV1/model_usage_top_avg_metrics_response.go +++ b/api/datadogV1/model_usage_top_avg_metrics_response.go @@ -120,8 +120,7 @@ func (o *UsageTopAvgMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { Metadata *UsageTopAvgMetricsMetadata `json:"metadata,omitempty"` Usage []UsageTopAvgMetricsHour `json:"usage,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_user.go b/api/datadogV1/model_user.go index 0ab9fc1046f..e3ee941ee62 100644 --- a/api/datadogV1/model_user.go +++ b/api/datadogV1/model_user.go @@ -294,8 +294,7 @@ func (o *User) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Verified *bool `json:"verified,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_user_disable_response.go b/api/datadogV1/model_user_disable_response.go index 97547a2d3be..4881249d54e 100644 --- a/api/datadogV1/model_user_disable_response.go +++ b/api/datadogV1/model_user_disable_response.go @@ -86,8 +86,7 @@ func (o *UserDisableResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Message *string `json:"message,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_user_list_response.go b/api/datadogV1/model_user_list_response.go index aad55866bb2..1ae35cbaae1 100644 --- a/api/datadogV1/model_user_list_response.go +++ b/api/datadogV1/model_user_list_response.go @@ -86,8 +86,7 @@ func (o *UserListResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Users []User `json:"users,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_user_response.go b/api/datadogV1/model_user_response.go index 3701e439eff..7e6c044e4e9 100644 --- a/api/datadogV1/model_user_response.go +++ b/api/datadogV1/model_user_response.go @@ -86,8 +86,7 @@ func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { User *User `json:"user,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_webhooks_integration.go b/api/datadogV1/model_webhooks_integration.go index bfd225dbd35..d336bd50d59 100644 --- a/api/datadogV1/model_webhooks_integration.go +++ b/api/datadogV1/model_webhooks_integration.go @@ -236,29 +236,14 @@ func (o WebhooksIntegration) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Url *string `json:"url"` - }{} all := struct { CustomHeaders datadog.NullableString `json:"custom_headers,omitempty"` EncodeAs *WebhooksIntegrationEncoding `json:"encode_as,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Payload datadog.NullableString `json:"payload,omitempty"` - Url string `json:"url"` + Url *string `json:"url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -266,6 +251,12 @@ func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_headers", "encode_as", "name", "payload", "url"}) @@ -282,9 +273,9 @@ func (o *WebhooksIntegration) UnmarshalJSON(bytes []byte) (err error) { } o.CustomHeaders = all.CustomHeaders o.EncodeAs = all.EncodeAs - o.Name = all.Name + o.Name = *all.Name o.Payload = all.Payload - o.Url = all.Url + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_webhooks_integration_custom_variable.go b/api/datadogV1/model_webhooks_integration_custom_variable.go index bda045537c0..9f3eed3b051 100644 --- a/api/datadogV1/model_webhooks_integration_custom_variable.go +++ b/api/datadogV1/model_webhooks_integration_custom_variable.go @@ -133,31 +133,12 @@ func (o WebhooksIntegrationCustomVariable) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegrationCustomVariable) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { IsSecret *bool `json:"is_secret"` Name *string `json:"name"` Value *string `json:"value"` }{} - all := struct { - IsSecret bool `json:"is_secret"` - Name string `json:"name"` - Value string `json:"value"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IsSecret == nil { - return fmt.Errorf("required field is_secret missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Value == nil { - return fmt.Errorf("required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -165,15 +146,24 @@ func (o *WebhooksIntegrationCustomVariable) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.IsSecret == nil { + return fmt.Errorf("required field is_secret missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_secret", "name", "value"}) } else { return err } - o.IsSecret = all.IsSecret - o.Name = all.Name - o.Value = all.Value + o.IsSecret = *all.IsSecret + o.Name = *all.Name + o.Value = *all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_webhooks_integration_custom_variable_response.go b/api/datadogV1/model_webhooks_integration_custom_variable_response.go index c010edc81e2..676bcaa4d0c 100644 --- a/api/datadogV1/model_webhooks_integration_custom_variable_response.go +++ b/api/datadogV1/model_webhooks_integration_custom_variable_response.go @@ -139,27 +139,12 @@ func (o WebhooksIntegrationCustomVariableResponse) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *WebhooksIntegrationCustomVariableResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { IsSecret *bool `json:"is_secret"` Name *string `json:"name"` - }{} - all := struct { - IsSecret bool `json:"is_secret"` - Name string `json:"name"` Value *string `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IsSecret == nil { - return fmt.Errorf("required field is_secret missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -167,14 +152,20 @@ func (o *WebhooksIntegrationCustomVariableResponse) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.IsSecret == nil { + return fmt.Errorf("required field is_secret missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"is_secret", "name", "value"}) } else { return err } - o.IsSecret = all.IsSecret - o.Name = all.Name + o.IsSecret = *all.IsSecret + o.Name = *all.Name o.Value = all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go b/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go index dd946b3368b..c279c51ec21 100644 --- a/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go +++ b/api/datadogV1/model_webhooks_integration_custom_variable_update_request.go @@ -157,8 +157,7 @@ func (o *WebhooksIntegrationCustomVariableUpdateRequest) UnmarshalJSON(bytes []b Name *string `json:"name,omitempty"` Value *string `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_webhooks_integration_update_request.go b/api/datadogV1/model_webhooks_integration_update_request.go index 75eef4ab217..db50cf1b950 100644 --- a/api/datadogV1/model_webhooks_integration_update_request.go +++ b/api/datadogV1/model_webhooks_integration_update_request.go @@ -245,8 +245,7 @@ func (o *WebhooksIntegrationUpdateRequest) UnmarshalJSON(bytes []byte) (err erro Payload datadog.NullableString `json:"payload,omitempty"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget.go b/api/datadogV1/model_widget.go index f79a462b046..764fa6d40ec 100644 --- a/api/datadogV1/model_widget.go +++ b/api/datadogV1/model_widget.go @@ -149,23 +149,12 @@ func (o Widget) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Widget) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Definition *WidgetDefinition `json:"definition"` - }{} all := struct { - Definition WidgetDefinition `json:"definition"` - Id *int64 `json:"id,omitempty"` - Layout *WidgetLayout `json:"layout,omitempty"` + Definition *WidgetDefinition `json:"definition"` + Id *int64 `json:"id,omitempty"` + Layout *WidgetLayout `json:"layout,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Definition == nil { - return fmt.Errorf("required field definition missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -173,13 +162,16 @@ func (o *Widget) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Definition == nil { + return fmt.Errorf("required field definition missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"definition", "id", "layout"}) } else { return err } - o.Definition = all.Definition + o.Definition = *all.Definition o.Id = all.Id if all.Layout != nil && all.Layout.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV1/model_widget_axis.go b/api/datadogV1/model_widget_axis.go index f5da6577503..cc8c7153893 100644 --- a/api/datadogV1/model_widget_axis.go +++ b/api/datadogV1/model_widget_axis.go @@ -234,8 +234,7 @@ func (o *WidgetAxis) UnmarshalJSON(bytes []byte) (err error) { Min *string `json:"min,omitempty"` Scale *string `json:"scale,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget_conditional_format.go b/api/datadogV1/model_widget_conditional_format.go index f46280c4842..5132d56210a 100644 --- a/api/datadogV1/model_widget_conditional_format.go +++ b/api/datadogV1/model_widget_conditional_format.go @@ -330,37 +330,18 @@ func (o WidgetConditionalFormat) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Comparator *WidgetComparator `json:"comparator"` - Palette *WidgetPalette `json:"palette"` - Value *float64 `json:"value"` - }{} all := struct { - Comparator WidgetComparator `json:"comparator"` - CustomBgColor *string `json:"custom_bg_color,omitempty"` - CustomFgColor *string `json:"custom_fg_color,omitempty"` - HideValue *bool `json:"hide_value,omitempty"` - ImageUrl *string `json:"image_url,omitempty"` - Metric *string `json:"metric,omitempty"` - Palette WidgetPalette `json:"palette"` - Timeframe *string `json:"timeframe,omitempty"` - Value float64 `json:"value"` + Comparator *WidgetComparator `json:"comparator"` + CustomBgColor *string `json:"custom_bg_color,omitempty"` + CustomFgColor *string `json:"custom_fg_color,omitempty"` + HideValue *bool `json:"hide_value,omitempty"` + ImageUrl *string `json:"image_url,omitempty"` + Metric *string `json:"metric,omitempty"` + Palette *WidgetPalette `json:"palette"` + Timeframe *string `json:"timeframe,omitempty"` + Value *float64 `json:"value"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Comparator == nil { - return fmt.Errorf("required field comparator missing") - } - if required.Palette == nil { - return fmt.Errorf("required field palette missing") - } - if required.Value == nil { - return fmt.Errorf("required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -368,6 +349,15 @@ func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Comparator == nil { + return fmt.Errorf("required field comparator missing") + } + if all.Palette == nil { + return fmt.Errorf("required field palette missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"comparator", "custom_bg_color", "custom_fg_color", "hide_value", "image_url", "metric", "palette", "timeframe", "value"}) @@ -390,15 +380,15 @@ func (o *WidgetConditionalFormat) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Comparator = all.Comparator + o.Comparator = *all.Comparator o.CustomBgColor = all.CustomBgColor o.CustomFgColor = all.CustomFgColor o.HideValue = all.HideValue o.ImageUrl = all.ImageUrl o.Metric = all.Metric - o.Palette = all.Palette + o.Palette = *all.Palette o.Timeframe = all.Timeframe - o.Value = all.Value + o.Value = *all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_widget_custom_link.go b/api/datadogV1/model_widget_custom_link.go index d79a323f8ad..0a614f337eb 100644 --- a/api/datadogV1/model_widget_custom_link.go +++ b/api/datadogV1/model_widget_custom_link.go @@ -188,8 +188,7 @@ func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { Link *string `json:"link,omitempty"` OverrideLabel *string `json:"override_label,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget_event.go b/api/datadogV1/model_widget_event.go index 272a6682d62..3a335716c61 100644 --- a/api/datadogV1/model_widget_event.go +++ b/api/datadogV1/model_widget_event.go @@ -114,22 +114,11 @@ func (o WidgetEvent) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetEvent) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Q *string `json:"q"` - }{} all := struct { - Q string `json:"q"` + Q *string `json:"q"` TagsExecution *string `json:"tags_execution,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Q == nil { - return fmt.Errorf("required field q missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -137,13 +126,16 @@ func (o *WidgetEvent) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Q == nil { + return fmt.Errorf("required field q missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"q", "tags_execution"}) } else { return err } - o.Q = all.Q + o.Q = *all.Q o.TagsExecution = all.TagsExecution if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV1/model_widget_field_sort.go b/api/datadogV1/model_widget_field_sort.go index eacfcf1234a..84987eca798 100644 --- a/api/datadogV1/model_widget_field_sort.go +++ b/api/datadogV1/model_widget_field_sort.go @@ -105,26 +105,11 @@ func (o WidgetFieldSort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Column *string `json:"column"` Order *WidgetSort `json:"order"` }{} - all := struct { - Column string `json:"column"` - Order WidgetSort `json:"order"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Column == nil { - return fmt.Errorf("required field column missing") - } - if required.Order == nil { - return fmt.Errorf("required field order missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Column == nil { + return fmt.Errorf("required field column missing") + } + if all.Order == nil { + return fmt.Errorf("required field order missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"column", "order"}) @@ -146,8 +137,8 @@ func (o *WidgetFieldSort) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Column = all.Column - o.Order = all.Order + o.Column = *all.Column + o.Order = *all.Order if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_widget_formula.go b/api/datadogV1/model_widget_formula.go index 79cb0612654..bfd5cf1e35e 100644 --- a/api/datadogV1/model_widget_formula.go +++ b/api/datadogV1/model_widget_formula.go @@ -243,26 +243,15 @@ func (o WidgetFormula) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Formula *string `json:"formula"` - }{} all := struct { Alias *string `json:"alias,omitempty"` CellDisplayMode *TableWidgetCellDisplayMode `json:"cell_display_mode,omitempty"` ConditionalFormats []WidgetConditionalFormat `json:"conditional_formats,omitempty"` - Formula string `json:"formula"` + Formula *string `json:"formula"` Limit *WidgetFormulaLimit `json:"limit,omitempty"` Style *WidgetFormulaStyle `json:"style,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Formula == nil { - return fmt.Errorf("required field formula missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -270,6 +259,9 @@ func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Formula == nil { + return fmt.Errorf("required field formula missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"alias", "cell_display_mode", "conditional_formats", "formula", "limit", "style"}) @@ -287,7 +279,7 @@ func (o *WidgetFormula) UnmarshalJSON(bytes []byte) (err error) { o.Alias = all.Alias o.CellDisplayMode = all.CellDisplayMode o.ConditionalFormats = all.ConditionalFormats - o.Formula = all.Formula + o.Formula = *all.Formula if all.Limit != nil && all.Limit.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV1/model_widget_formula_limit.go b/api/datadogV1/model_widget_formula_limit.go index 99a7550f7cf..78952a5b5cf 100644 --- a/api/datadogV1/model_widget_formula_limit.go +++ b/api/datadogV1/model_widget_formula_limit.go @@ -124,8 +124,7 @@ func (o *WidgetFormulaLimit) UnmarshalJSON(bytes []byte) (err error) { Count *int64 `json:"count,omitempty"` Order *QuerySortOrder `json:"order,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget_formula_style.go b/api/datadogV1/model_widget_formula_style.go index 4f5aa4c8feb..ea3ad796a4f 100644 --- a/api/datadogV1/model_widget_formula_style.go +++ b/api/datadogV1/model_widget_formula_style.go @@ -120,8 +120,7 @@ func (o *WidgetFormulaStyle) UnmarshalJSON(bytes []byte) (err error) { Palette *string `json:"palette,omitempty"` PaletteIndex *int64 `json:"palette_index,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget_layout.go b/api/datadogV1/model_widget_layout.go index 2a5a4eb81cb..7820adb7bb6 100644 --- a/api/datadogV1/model_widget_layout.go +++ b/api/datadogV1/model_widget_layout.go @@ -193,55 +193,44 @@ func (o WidgetLayout) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetLayout) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Height *int64 `json:"height"` - Width *int64 `json:"width"` - X *int64 `json:"x"` - Y *int64 `json:"y"` - }{} all := struct { - Height int64 `json:"height"` - IsColumnBreak *bool `json:"is_column_break,omitempty"` - Width int64 `json:"width"` - X int64 `json:"x"` - Y int64 `json:"y"` + Height *int64 `json:"height"` + IsColumnBreak *bool `json:"is_column_break,omitempty"` + Width *int64 `json:"width"` + X *int64 `json:"x"` + Y *int64 `json:"y"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Height == nil { + if all.Height == nil { return fmt.Errorf("required field height missing") } - if required.Width == nil { + if all.Width == nil { return fmt.Errorf("required field width missing") } - if required.X == nil { + if all.X == nil { return fmt.Errorf("required field x missing") } - if required.Y == nil { + if all.Y == nil { return fmt.Errorf("required field y missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"height", "is_column_break", "width", "x", "y"}) } else { return err } - o.Height = all.Height + o.Height = *all.Height o.IsColumnBreak = all.IsColumnBreak - o.Width = all.Width - o.X = all.X - o.Y = all.Y + o.Width = *all.Width + o.X = *all.X + o.Y = *all.Y if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_widget_marker.go b/api/datadogV1/model_widget_marker.go index 688a91f2dad..77ad652e972 100644 --- a/api/datadogV1/model_widget_marker.go +++ b/api/datadogV1/model_widget_marker.go @@ -181,24 +181,13 @@ func (o WidgetMarker) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Value *string `json:"value"` - }{} all := struct { DisplayType *string `json:"display_type,omitempty"` Label *string `json:"label,omitempty"` Time *string `json:"time,omitempty"` - Value string `json:"value"` + Value *string `json:"value"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Value == nil { - return fmt.Errorf("required field value missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -206,6 +195,9 @@ func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"display_type", "label", "time", "value"}) @@ -215,7 +207,7 @@ func (o *WidgetMarker) UnmarshalJSON(bytes []byte) (err error) { o.DisplayType = all.DisplayType o.Label = all.Label o.Time = all.Time - o.Value = all.Value + o.Value = *all.Value if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV1/model_widget_request_style.go b/api/datadogV1/model_widget_request_style.go index dcd52cdd326..0d49fd1b923 100644 --- a/api/datadogV1/model_widget_request_style.go +++ b/api/datadogV1/model_widget_request_style.go @@ -154,8 +154,7 @@ func (o *WidgetRequestStyle) UnmarshalJSON(bytes []byte) (err error) { LineWidth *WidgetLineWidth `json:"line_width,omitempty"` Palette *string `json:"palette,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget_style.go b/api/datadogV1/model_widget_style.go index fcf1c60b97d..ad0749ee48f 100644 --- a/api/datadogV1/model_widget_style.go +++ b/api/datadogV1/model_widget_style.go @@ -86,8 +86,7 @@ func (o *WidgetStyle) UnmarshalJSON(bytes []byte) (err error) { all := struct { Palette *string `json:"palette,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV1/model_widget_time.go b/api/datadogV1/model_widget_time.go index f20856f50b4..73ea17cf37a 100644 --- a/api/datadogV1/model_widget_time.go +++ b/api/datadogV1/model_widget_time.go @@ -86,8 +86,7 @@ func (o *WidgetTime) UnmarshalJSON(bytes []byte) (err error) { all := struct { LiveSpan *WidgetLiveSpan `json:"live_span,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_api_error_response.go b/api/datadogV2/model_api_error_response.go index bcbe40ff8be..f028075a60c 100644 --- a/api/datadogV2/model_api_error_response.go +++ b/api/datadogV2/model_api_error_response.go @@ -78,21 +78,10 @@ func (o APIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Errors *[]string `json:"errors"` - }{} all := struct { - Errors []string `json:"errors"` + Errors *[]string `json:"errors"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Errors == nil { - return fmt.Errorf("required field errors missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *APIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Errors == nil { + return fmt.Errorf("required field errors missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"errors"}) } else { return err } - o.Errors = all.Errors + o.Errors = *all.Errors if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_key_create_attributes.go b/api/datadogV2/model_api_key_create_attributes.go index 8e67b7461be..229e08e9fcf 100644 --- a/api/datadogV2/model_api_key_create_attributes.go +++ b/api/datadogV2/model_api_key_create_attributes.go @@ -78,21 +78,10 @@ func (o APIKeyCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *APIKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_key_create_data.go b/api/datadogV2/model_api_key_create_data.go index d9ca01c7bcd..4e9818cd326 100644 --- a/api/datadogV2/model_api_key_create_data.go +++ b/api/datadogV2/model_api_key_create_data.go @@ -107,26 +107,11 @@ func (o APIKeyCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *APIKeyCreateAttributes `json:"attributes"` Type *APIKeysType `json:"type"` }{} - all := struct { - Attributes APIKeyCreateAttributes `json:"attributes"` - Type APIKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *APIKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_key_create_request.go b/api/datadogV2/model_api_key_create_request.go index db9099d0e2c..b65353190a2 100644 --- a/api/datadogV2/model_api_key_create_request.go +++ b/api/datadogV2/model_api_key_create_request.go @@ -78,21 +78,10 @@ func (o APIKeyCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *APIKeyCreateData `json:"data"` - }{} all := struct { - Data APIKeyCreateData `json:"data"` + Data *APIKeyCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *APIKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_key_relationships.go b/api/datadogV2/model_api_key_relationships.go index d7bed3b868c..a1d6f5fca4c 100644 --- a/api/datadogV2/model_api_key_relationships.go +++ b/api/datadogV2/model_api_key_relationships.go @@ -120,8 +120,7 @@ func (o *APIKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { CreatedBy *RelationshipToUser `json:"created_by,omitempty"` ModifiedBy *RelationshipToUser `json:"modified_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_api_key_response.go b/api/datadogV2/model_api_key_response.go index ccfde428d73..9927b9a2ff4 100644 --- a/api/datadogV2/model_api_key_response.go +++ b/api/datadogV2/model_api_key_response.go @@ -120,8 +120,7 @@ func (o *APIKeyResponse) UnmarshalJSON(bytes []byte) (err error) { Data *FullAPIKey `json:"data,omitempty"` Included []APIKeyResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_api_key_update_attributes.go b/api/datadogV2/model_api_key_update_attributes.go index 9d2c9cad981..9edb6437342 100644 --- a/api/datadogV2/model_api_key_update_attributes.go +++ b/api/datadogV2/model_api_key_update_attributes.go @@ -78,21 +78,10 @@ func (o APIKeyUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *APIKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_key_update_data.go b/api/datadogV2/model_api_key_update_data.go index 429dec4b4e6..e67172f16d2 100644 --- a/api/datadogV2/model_api_key_update_data.go +++ b/api/datadogV2/model_api_key_update_data.go @@ -134,31 +134,12 @@ func (o APIKeyUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *APIKeyUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *APIKeysType `json:"type"` }{} - all := struct { - Attributes APIKeyUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type APIKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *APIKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_key_update_request.go b/api/datadogV2/model_api_key_update_request.go index ba0116c89d4..eb5f95654d2 100644 --- a/api/datadogV2/model_api_key_update_request.go +++ b/api/datadogV2/model_api_key_update_request.go @@ -78,21 +78,10 @@ func (o APIKeyUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *APIKeyUpdateData `json:"data"` - }{} all := struct { - Data APIKeyUpdateData `json:"data"` + Data *APIKeyUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *APIKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_api_keys_response.go b/api/datadogV2/model_api_keys_response.go index 6ebd5b659f4..a3a4c3f385a 100644 --- a/api/datadogV2/model_api_keys_response.go +++ b/api/datadogV2/model_api_keys_response.go @@ -120,8 +120,7 @@ func (o *APIKeysResponse) UnmarshalJSON(bytes []byte) (err error) { Data []PartialAPIKey `json:"data,omitempty"` Included []APIKeyResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_application_key_create_attributes.go b/api/datadogV2/model_application_key_create_attributes.go index aee6ed25085..b6b753970e0 100644 --- a/api/datadogV2/model_application_key_create_attributes.go +++ b/api/datadogV2/model_application_key_create_attributes.go @@ -122,22 +122,11 @@ func (o ApplicationKeyCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -145,13 +134,16 @@ func (o *ApplicationKeyCreateAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "scopes"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name o.Scopes = all.Scopes if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_application_key_create_data.go b/api/datadogV2/model_application_key_create_data.go index 8502ad897e7..20aae360a77 100644 --- a/api/datadogV2/model_application_key_create_data.go +++ b/api/datadogV2/model_application_key_create_data.go @@ -107,26 +107,11 @@ func (o ApplicationKeyCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ApplicationKeyCreateAttributes `json:"attributes"` Type *ApplicationKeysType `json:"type"` }{} - all := struct { - Attributes ApplicationKeyCreateAttributes `json:"attributes"` - Type ApplicationKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *ApplicationKeyCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_application_key_create_request.go b/api/datadogV2/model_application_key_create_request.go index 84597734096..de268c5b23c 100644 --- a/api/datadogV2/model_application_key_create_request.go +++ b/api/datadogV2/model_application_key_create_request.go @@ -78,21 +78,10 @@ func (o ApplicationKeyCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ApplicationKeyCreateData `json:"data"` - }{} all := struct { - Data ApplicationKeyCreateData `json:"data"` + Data *ApplicationKeyCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ApplicationKeyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_application_key_relationships.go b/api/datadogV2/model_application_key_relationships.go index c1fe34dd97c..e66e08036ee 100644 --- a/api/datadogV2/model_application_key_relationships.go +++ b/api/datadogV2/model_application_key_relationships.go @@ -86,8 +86,7 @@ func (o *ApplicationKeyRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { OwnedBy *RelationshipToUser `json:"owned_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_application_key_response.go b/api/datadogV2/model_application_key_response.go index f770b8426fc..183aa689843 100644 --- a/api/datadogV2/model_application_key_response.go +++ b/api/datadogV2/model_application_key_response.go @@ -120,8 +120,7 @@ func (o *ApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) { Data *FullApplicationKey `json:"data,omitempty"` Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_application_key_update_attributes.go b/api/datadogV2/model_application_key_update_attributes.go index e71d7830308..d191636b283 100644 --- a/api/datadogV2/model_application_key_update_attributes.go +++ b/api/datadogV2/model_application_key_update_attributes.go @@ -131,8 +131,7 @@ func (o *ApplicationKeyUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) Name *string `json:"name,omitempty"` Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_application_key_update_data.go b/api/datadogV2/model_application_key_update_data.go index 39350032c44..7eb8a24ce7e 100644 --- a/api/datadogV2/model_application_key_update_data.go +++ b/api/datadogV2/model_application_key_update_data.go @@ -134,31 +134,12 @@ func (o ApplicationKeyUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ApplicationKeyUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *ApplicationKeysType `json:"type"` }{} - all := struct { - Attributes ApplicationKeyUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type ApplicationKeysType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *ApplicationKeyUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_application_key_update_request.go b/api/datadogV2/model_application_key_update_request.go index 53e6360d397..4289acac7af 100644 --- a/api/datadogV2/model_application_key_update_request.go +++ b/api/datadogV2/model_application_key_update_request.go @@ -78,21 +78,10 @@ func (o ApplicationKeyUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ApplicationKeyUpdateData `json:"data"` - }{} all := struct { - Data ApplicationKeyUpdateData `json:"data"` + Data *ApplicationKeyUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ApplicationKeyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_audit_logs_event.go b/api/datadogV2/model_audit_logs_event.go index 4a96331a4b7..ca38fe47f02 100644 --- a/api/datadogV2/model_audit_logs_event.go +++ b/api/datadogV2/model_audit_logs_event.go @@ -158,8 +158,7 @@ func (o *AuditLogsEvent) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *AuditLogsEventType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_event_attributes.go b/api/datadogV2/model_audit_logs_event_attributes.go index eb85f2d51bc..95b1b63da61 100644 --- a/api/datadogV2/model_audit_logs_event_attributes.go +++ b/api/datadogV2/model_audit_logs_event_attributes.go @@ -195,8 +195,7 @@ func (o *AuditLogsEventAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_events_response.go b/api/datadogV2/model_audit_logs_events_response.go index 8b4aca4260d..7625b49cb85 100644 --- a/api/datadogV2/model_audit_logs_events_response.go +++ b/api/datadogV2/model_audit_logs_events_response.go @@ -154,8 +154,7 @@ func (o *AuditLogsEventsResponse) UnmarshalJSON(bytes []byte) (err error) { Links *AuditLogsResponseLinks `json:"links,omitempty"` Meta *AuditLogsResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_query_filter.go b/api/datadogV2/model_audit_logs_query_filter.go index 48120cf2a8c..bf9f994d3e4 100644 --- a/api/datadogV2/model_audit_logs_query_filter.go +++ b/api/datadogV2/model_audit_logs_query_filter.go @@ -166,8 +166,7 @@ func (o *AuditLogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_query_options.go b/api/datadogV2/model_audit_logs_query_options.go index 4cfcfac51ee..1bcbd329726 100644 --- a/api/datadogV2/model_audit_logs_query_options.go +++ b/api/datadogV2/model_audit_logs_query_options.go @@ -125,8 +125,7 @@ func (o *AuditLogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { TimeOffset *int64 `json:"time_offset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_query_page_options.go b/api/datadogV2/model_audit_logs_query_page_options.go index 5ca2f8e959b..1879fcacf86 100644 --- a/api/datadogV2/model_audit_logs_query_page_options.go +++ b/api/datadogV2/model_audit_logs_query_page_options.go @@ -124,8 +124,7 @@ func (o *AuditLogsQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_response_links.go b/api/datadogV2/model_audit_logs_response_links.go index 50af729bc8a..6c3150d5a51 100644 --- a/api/datadogV2/model_audit_logs_response_links.go +++ b/api/datadogV2/model_audit_logs_response_links.go @@ -87,8 +87,7 @@ func (o *AuditLogsResponseLinks) UnmarshalJSON(bytes []byte) (err error) { all := struct { Next *string `json:"next,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_response_metadata.go b/api/datadogV2/model_audit_logs_response_metadata.go index 019956d2f27..cab84844909 100644 --- a/api/datadogV2/model_audit_logs_response_metadata.go +++ b/api/datadogV2/model_audit_logs_response_metadata.go @@ -223,8 +223,7 @@ func (o *AuditLogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Status *AuditLogsResponseStatus `json:"status,omitempty"` Warnings []AuditLogsWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_response_page.go b/api/datadogV2/model_audit_logs_response_page.go index e19364ffa41..2f7f61dcc5e 100644 --- a/api/datadogV2/model_audit_logs_response_page.go +++ b/api/datadogV2/model_audit_logs_response_page.go @@ -86,8 +86,7 @@ func (o *AuditLogsResponsePage) UnmarshalJSON(bytes []byte) (err error) { all := struct { After *string `json:"after,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_search_events_request.go b/api/datadogV2/model_audit_logs_search_events_request.go index 3d707e82974..4750ec46cf8 100644 --- a/api/datadogV2/model_audit_logs_search_events_request.go +++ b/api/datadogV2/model_audit_logs_search_events_request.go @@ -189,8 +189,7 @@ func (o *AuditLogsSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Page *AuditLogsQueryPageOptions `json:"page,omitempty"` Sort *AuditLogsSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_audit_logs_warning.go b/api/datadogV2/model_audit_logs_warning.go index 53a3a7de62f..de3d7c577aa 100644 --- a/api/datadogV2/model_audit_logs_warning.go +++ b/api/datadogV2/model_audit_logs_warning.go @@ -154,8 +154,7 @@ func (o *AuditLogsWarning) UnmarshalJSON(bytes []byte) (err error) { Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping.go b/api/datadogV2/model_auth_n_mapping.go index 10f00cdedbd..ebfa3088b6e 100644 --- a/api/datadogV2/model_auth_n_mapping.go +++ b/api/datadogV2/model_auth_n_mapping.go @@ -173,28 +173,13 @@ func (o AuthNMapping) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *AuthNMappingsType `json:"type"` - }{} all := struct { Attributes *AuthNMappingAttributes `json:"attributes,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` Relationships *AuthNMappingRelationships `json:"relationships,omitempty"` - Type AuthNMappingsType `json:"type"` + Type *AuthNMappingsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +187,12 @@ func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -224,7 +215,7 @@ func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -233,7 +224,7 @@ func (o *AuthNMapping) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_auth_n_mapping_attributes.go b/api/datadogV2/model_auth_n_mapping_attributes.go index 787fe9318c0..63a554e61f4 100644 --- a/api/datadogV2/model_auth_n_mapping_attributes.go +++ b/api/datadogV2/model_auth_n_mapping_attributes.go @@ -231,8 +231,7 @@ func (o *AuthNMappingAttributes) UnmarshalJSON(bytes []byte) (err error) { ModifiedAt *time.Time `json:"modified_at,omitempty"` SamlAssertionAttributeId *string `json:"saml_assertion_attribute_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_create_attributes.go b/api/datadogV2/model_auth_n_mapping_create_attributes.go index c1ba41e98f7..e5feb3982c7 100644 --- a/api/datadogV2/model_auth_n_mapping_create_attributes.go +++ b/api/datadogV2/model_auth_n_mapping_create_attributes.go @@ -120,8 +120,7 @@ func (o *AuthNMappingCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_create_data.go b/api/datadogV2/model_auth_n_mapping_create_data.go index d45fb2fc535..92cfdf097e9 100644 --- a/api/datadogV2/model_auth_n_mapping_create_data.go +++ b/api/datadogV2/model_auth_n_mapping_create_data.go @@ -146,23 +146,12 @@ func (o AuthNMappingCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *AuthNMappingsType `json:"type"` - }{} all := struct { Attributes *AuthNMappingCreateAttributes `json:"attributes,omitempty"` Relationships *AuthNMappingCreateRelationships `json:"relationships,omitempty"` - Type AuthNMappingsType `json:"type"` + Type *AuthNMappingsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -200,7 +192,7 @@ func (o *AuthNMappingCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_auth_n_mapping_create_relationships.go b/api/datadogV2/model_auth_n_mapping_create_relationships.go index c911ce72ff8..005e54f97de 100644 --- a/api/datadogV2/model_auth_n_mapping_create_relationships.go +++ b/api/datadogV2/model_auth_n_mapping_create_relationships.go @@ -86,8 +86,7 @@ func (o *AuthNMappingCreateRelationships) UnmarshalJSON(bytes []byte) (err error all := struct { Role *RelationshipToRole `json:"role,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_create_request.go b/api/datadogV2/model_auth_n_mapping_create_request.go index 851059dd883..b6cbb9b0db2 100644 --- a/api/datadogV2/model_auth_n_mapping_create_request.go +++ b/api/datadogV2/model_auth_n_mapping_create_request.go @@ -78,21 +78,10 @@ func (o AuthNMappingCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *AuthNMappingCreateData `json:"data"` - }{} all := struct { - Data AuthNMappingCreateData `json:"data"` + Data *AuthNMappingCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *AuthNMappingCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_auth_n_mapping_relationships.go b/api/datadogV2/model_auth_n_mapping_relationships.go index 5cc51a37554..73005ca262c 100644 --- a/api/datadogV2/model_auth_n_mapping_relationships.go +++ b/api/datadogV2/model_auth_n_mapping_relationships.go @@ -120,8 +120,7 @@ func (o *AuthNMappingRelationships) UnmarshalJSON(bytes []byte) (err error) { Role *RelationshipToRole `json:"role,omitempty"` SamlAssertionAttribute *RelationshipToSAMLAssertionAttribute `json:"saml_assertion_attribute,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_response.go b/api/datadogV2/model_auth_n_mapping_response.go index d859cff6859..5ec7fde174d 100644 --- a/api/datadogV2/model_auth_n_mapping_response.go +++ b/api/datadogV2/model_auth_n_mapping_response.go @@ -120,8 +120,7 @@ func (o *AuthNMappingResponse) UnmarshalJSON(bytes []byte) (err error) { Data *AuthNMapping `json:"data,omitempty"` Included []AuthNMappingIncluded `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_update_attributes.go b/api/datadogV2/model_auth_n_mapping_update_attributes.go index f2378c9e89f..9a61267d4b3 100644 --- a/api/datadogV2/model_auth_n_mapping_update_attributes.go +++ b/api/datadogV2/model_auth_n_mapping_update_attributes.go @@ -120,8 +120,7 @@ func (o *AuthNMappingUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_update_data.go b/api/datadogV2/model_auth_n_mapping_update_data.go index 262fae92818..2e1c4edb0b3 100644 --- a/api/datadogV2/model_auth_n_mapping_update_data.go +++ b/api/datadogV2/model_auth_n_mapping_update_data.go @@ -173,28 +173,13 @@ func (o AuthNMappingUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *AuthNMappingsType `json:"type"` - }{} all := struct { Attributes *AuthNMappingUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` Relationships *AuthNMappingUpdateRelationships `json:"relationships,omitempty"` - Type AuthNMappingsType `json:"type"` + Type *AuthNMappingsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +187,12 @@ func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -224,7 +215,7 @@ func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -233,7 +224,7 @@ func (o *AuthNMappingUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_auth_n_mapping_update_relationships.go b/api/datadogV2/model_auth_n_mapping_update_relationships.go index 94b84c90233..ebe5598449f 100644 --- a/api/datadogV2/model_auth_n_mapping_update_relationships.go +++ b/api/datadogV2/model_auth_n_mapping_update_relationships.go @@ -86,8 +86,7 @@ func (o *AuthNMappingUpdateRelationships) UnmarshalJSON(bytes []byte) (err error all := struct { Role *RelationshipToRole `json:"role,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_auth_n_mapping_update_request.go b/api/datadogV2/model_auth_n_mapping_update_request.go index bb850ecd5d0..bad1ea4d5e3 100644 --- a/api/datadogV2/model_auth_n_mapping_update_request.go +++ b/api/datadogV2/model_auth_n_mapping_update_request.go @@ -78,21 +78,10 @@ func (o AuthNMappingUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *AuthNMappingUpdateData `json:"data"` - }{} all := struct { - Data AuthNMappingUpdateData `json:"data"` + Data *AuthNMappingUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *AuthNMappingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_auth_n_mappings_response.go b/api/datadogV2/model_auth_n_mappings_response.go index 5bc5f0de3af..e7bf8785eb6 100644 --- a/api/datadogV2/model_auth_n_mappings_response.go +++ b/api/datadogV2/model_auth_n_mappings_response.go @@ -154,8 +154,7 @@ func (o *AuthNMappingsResponse) UnmarshalJSON(bytes []byte) (err error) { Included []AuthNMappingIncluded `json:"included,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_chargeback_breakdown.go b/api/datadogV2/model_chargeback_breakdown.go index 84a4e88343d..a8efd7df2e9 100644 --- a/api/datadogV2/model_chargeback_breakdown.go +++ b/api/datadogV2/model_chargeback_breakdown.go @@ -154,8 +154,7 @@ func (o *ChargebackBreakdown) UnmarshalJSON(bytes []byte) (err error) { Cost *float64 `json:"cost,omitempty"` ProductName *string `json:"product_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go b/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go index e2e8f2ba6e7..0b90c68f3c8 100644 --- a/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go +++ b/api/datadogV2/model_ci_app_aggregate_bucket_value_timeseries_point.go @@ -125,8 +125,7 @@ func (o *CIAppAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) ( Time *time.Time `json:"time,omitempty"` Value *float64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_aggregate_sort.go b/api/datadogV2/model_ci_app_aggregate_sort.go index 88e060caf70..8c1cf7db9b6 100644 --- a/api/datadogV2/model_ci_app_aggregate_sort.go +++ b/api/datadogV2/model_ci_app_aggregate_sort.go @@ -192,8 +192,7 @@ func (o *CIAppAggregateSort) UnmarshalJSON(bytes []byte) (err error) { Order *CIAppSortOrder `json:"order,omitempty"` Type *CIAppAggregateSortType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_ci_error.go b/api/datadogV2/model_ci_app_ci_error.go index b1385cd9623..6ad2b2ce103 100644 --- a/api/datadogV2/model_ci_app_ci_error.go +++ b/api/datadogV2/model_ci_app_ci_error.go @@ -221,8 +221,7 @@ func (o *CIAppCIError) UnmarshalJSON(bytes []byte) (err error) { Stack datadog.NullableString `json:"stack,omitempty"` Type datadog.NullableString `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_compute.go b/api/datadogV2/model_ci_app_compute.go index 483a864c2e8..a831fdfac81 100644 --- a/api/datadogV2/model_ci_app_compute.go +++ b/api/datadogV2/model_ci_app_compute.go @@ -182,24 +182,13 @@ func (o CIAppCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *CIAppAggregationFunction `json:"aggregation"` - }{} all := struct { - Aggregation CIAppAggregationFunction `json:"aggregation"` - Interval *string `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - Type *CIAppComputeType `json:"type,omitempty"` + Aggregation *CIAppAggregationFunction `json:"aggregation"` + Interval *string `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *CIAppComputeType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -207,6 +196,9 @@ func (o *CIAppCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "interval", "metric", "type"}) @@ -229,7 +221,7 @@ func (o *CIAppCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric o.Type = all.Type diff --git a/api/datadogV2/model_ci_app_create_pipeline_event_request.go b/api/datadogV2/model_ci_app_create_pipeline_event_request.go index 05e436dc5ac..543c75b324c 100644 --- a/api/datadogV2/model_ci_app_create_pipeline_event_request.go +++ b/api/datadogV2/model_ci_app_create_pipeline_event_request.go @@ -86,8 +86,7 @@ func (o *CIAppCreatePipelineEventRequest) UnmarshalJSON(bytes []byte) (err error all := struct { Data *CIAppCreatePipelineEventRequestData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go b/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go index ce923fdae3b..5072060018b 100644 --- a/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go +++ b/api/datadogV2/model_ci_app_create_pipeline_event_request_attributes.go @@ -144,23 +144,12 @@ func (o CIAppCreatePipelineEventRequestAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CIAppCreatePipelineEventRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Resource *CIAppCreatePipelineEventRequestAttributesResource `json:"resource"` - }{} all := struct { - Env *string `json:"env,omitempty"` - Resource CIAppCreatePipelineEventRequestAttributesResource `json:"resource"` - Service *string `json:"service,omitempty"` + Env *string `json:"env,omitempty"` + Resource *CIAppCreatePipelineEventRequestAttributesResource `json:"resource"` + Service *string `json:"service,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Resource == nil { - return fmt.Errorf("required field resource missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *CIAppCreatePipelineEventRequestAttributes) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.Resource == nil { + return fmt.Errorf("required field resource missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"env", "resource", "service"}) @@ -175,7 +167,7 @@ func (o *CIAppCreatePipelineEventRequestAttributes) UnmarshalJSON(bytes []byte) return err } o.Env = all.Env - o.Resource = all.Resource + o.Resource = *all.Resource o.Service = all.Service if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go b/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go index 5b2ab567303..8e8ca056f4c 100644 --- a/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go +++ b/api/datadogV2/model_ci_app_create_pipeline_event_request_data.go @@ -124,8 +124,7 @@ func (o *CIAppCreatePipelineEventRequestData) UnmarshalJSON(bytes []byte) (err e Attributes *CIAppCreatePipelineEventRequestAttributes `json:"attributes,omitempty"` Type *CIAppCreatePipelineEventRequestDataType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_event_attributes.go b/api/datadogV2/model_ci_app_event_attributes.go index 065d4036bfb..6ed961e3375 100644 --- a/api/datadogV2/model_ci_app_event_attributes.go +++ b/api/datadogV2/model_ci_app_event_attributes.go @@ -195,8 +195,7 @@ func (o *CIAppEventAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_git_info.go b/api/datadogV2/model_ci_app_git_info.go index eb0ede874c8..744f3cebe44 100644 --- a/api/datadogV2/model_ci_app_git_info.go +++ b/api/datadogV2/model_ci_app_git_info.go @@ -529,13 +529,8 @@ func (o CIAppGitInfo) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - AuthorEmail *string `json:"author_email"` - RepositoryUrl *string `json:"repository_url"` - Sha *string `json:"sha"` - }{} all := struct { - AuthorEmail string `json:"author_email"` + AuthorEmail *string `json:"author_email"` AuthorName datadog.NullableString `json:"author_name,omitempty"` AuthorTime datadog.NullableString `json:"author_time,omitempty"` Branch datadog.NullableString `json:"branch,omitempty"` @@ -544,25 +539,11 @@ func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { CommitterName datadog.NullableString `json:"committer_name,omitempty"` DefaultBranch datadog.NullableString `json:"default_branch,omitempty"` Message datadog.NullableString `json:"message,omitempty"` - RepositoryUrl string `json:"repository_url"` - Sha string `json:"sha"` + RepositoryUrl *string `json:"repository_url"` + Sha *string `json:"sha"` Tag datadog.NullableString `json:"tag,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AuthorEmail == nil { - return fmt.Errorf("required field author_email missing") - } - if required.RepositoryUrl == nil { - return fmt.Errorf("required field repository_url missing") - } - if required.Sha == nil { - return fmt.Errorf("required field sha missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -570,13 +551,22 @@ func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AuthorEmail == nil { + return fmt.Errorf("required field author_email missing") + } + if all.RepositoryUrl == nil { + return fmt.Errorf("required field repository_url missing") + } + if all.Sha == nil { + return fmt.Errorf("required field sha missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author_email", "author_name", "author_time", "branch", "commit_time", "committer_email", "committer_name", "default_branch", "message", "repository_url", "sha", "tag"}) } else { return err } - o.AuthorEmail = all.AuthorEmail + o.AuthorEmail = *all.AuthorEmail o.AuthorName = all.AuthorName o.AuthorTime = all.AuthorTime o.Branch = all.Branch @@ -585,8 +575,8 @@ func (o *CIAppGitInfo) UnmarshalJSON(bytes []byte) (err error) { o.CommitterName = all.CommitterName o.DefaultBranch = all.DefaultBranch o.Message = all.Message - o.RepositoryUrl = all.RepositoryUrl - o.Sha = all.Sha + o.RepositoryUrl = *all.RepositoryUrl + o.Sha = *all.Sha o.Tag = all.Tag if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_ci_app_group_by_histogram.go b/api/datadogV2/model_ci_app_group_by_histogram.go index d818c36baa8..03a093b91ec 100644 --- a/api/datadogV2/model_ci_app_group_by_histogram.go +++ b/api/datadogV2/model_ci_app_group_by_histogram.go @@ -135,31 +135,12 @@ func (o CIAppGroupByHistogram) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Interval *float64 `json:"interval"` Max *float64 `json:"max"` Min *float64 `json:"min"` }{} - all := struct { - Interval float64 `json:"interval"` - Max float64 `json:"max"` - Min float64 `json:"min"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Interval == nil { - return fmt.Errorf("required field interval missing") - } - if required.Max == nil { - return fmt.Errorf("required field max missing") - } - if required.Min == nil { - return fmt.Errorf("required field min missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -167,15 +148,24 @@ func (o *CIAppGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Interval == nil { + return fmt.Errorf("required field interval missing") + } + if all.Max == nil { + return fmt.Errorf("required field max missing") + } + if all.Min == nil { + return fmt.Errorf("required field min missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"interval", "max", "min"}) } else { return err } - o.Interval = all.Interval - o.Max = all.Max - o.Min = all.Min + o.Interval = *all.Interval + o.Max = *all.Max + o.Min = *all.Min if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ci_app_host_info.go b/api/datadogV2/model_ci_app_host_info.go index 965743d3bed..8437bfac24c 100644 --- a/api/datadogV2/model_ci_app_host_info.go +++ b/api/datadogV2/model_ci_app_host_info.go @@ -188,8 +188,7 @@ func (o *CIAppHostInfo) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Workspace *string `json:"workspace,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipeline_event.go b/api/datadogV2/model_ci_app_pipeline_event.go index 77c768dc1c7..f3cbaa0ae07 100644 --- a/api/datadogV2/model_ci_app_pipeline_event.go +++ b/api/datadogV2/model_ci_app_pipeline_event.go @@ -154,8 +154,7 @@ func (o *CIAppPipelineEvent) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *CIAppPipelineEventTypeName `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipeline_event_job.go b/api/datadogV2/model_ci_app_pipeline_event_job.go index 0eea7c19513..cf99a882a06 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_job.go +++ b/api/datadogV2/model_ci_app_pipeline_event_job.go @@ -721,6 +721,7 @@ func (o CIAppPipelineEventJob) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} +<<<<<<< HEAD required := struct { End *time.Time `json:"end"` Git NullableCIAppGitInfo `json:"git"` @@ -733,27 +734,60 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { Status *CIAppPipelineEventJobStatus `json:"status"` Url *string `json:"url"` }{} +||||||| parent of 04c075be8 (Remove required unmarshal in models) + required := struct { + End *time.Time `json:"end"` + Id *string `json:"id"` + Level *CIAppPipelineEventJobLevel `json:"level"` + Name *string `json:"name"` + PipelineName *string `json:"pipeline_name"` + PipelineUniqueId *string `json:"pipeline_unique_id"` + Start *time.Time `json:"start"` + Status *CIAppPipelineEventJobStatus `json:"status"` + Url *string `json:"url"` + }{} +======= +>>>>>>> 04c075be8 (Remove required unmarshal in models) all := struct { Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` - End time.Time `json:"end"` + End *time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` +<<<<<<< HEAD Git NullableCIAppGitInfo `json:"git"` Id string `json:"id"` Level CIAppPipelineEventJobLevel `json:"level"` +||||||| parent of 04c075be8 (Remove required unmarshal in models) + Git NullableCIAppGitInfo `json:"git,omitempty"` + Id string `json:"id"` + Level CIAppPipelineEventJobLevel `json:"level"` +======= + Git NullableCIAppGitInfo `json:"git,omitempty"` + Id *string `json:"id"` + Level *CIAppPipelineEventJobLevel `json:"level"` +>>>>>>> 04c075be8 (Remove required unmarshal in models) Metrics datadog.NullableList[string] `json:"metrics,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Node NullableCIAppHostInfo `json:"node,omitempty"` Parameters map[string]string `json:"parameters,omitempty"` - PipelineName string `json:"pipeline_name"` - PipelineUniqueId string `json:"pipeline_unique_id"` + PipelineName *string `json:"pipeline_name"` + PipelineUniqueId *string `json:"pipeline_unique_id"` QueueTime datadog.NullableInt64 `json:"queue_time,omitempty"` StageId datadog.NullableString `json:"stage_id,omitempty"` StageName datadog.NullableString `json:"stage_name,omitempty"` - Start time.Time `json:"start"` - Status CIAppPipelineEventJobStatus `json:"status"` + Start *time.Time `json:"start"` + Status *CIAppPipelineEventJobStatus `json:"status"` Tags datadog.NullableList[string] `json:"tags,omitempty"` +<<<<<<< HEAD + Url string `json:"url"` +||||||| parent of 04c075be8 (Remove required unmarshal in models) Url string `json:"url"` + User NullableCIAppUserInfo `json:"user,omitempty"` +======= + Url *string `json:"url"` + User NullableCIAppUserInfo `json:"user,omitempty"` +>>>>>>> 04c075be8 (Remove required unmarshal in models) }{} +<<<<<<< HEAD err = json.Unmarshal(bytes, &required) if err != nil { return err @@ -790,6 +824,43 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { } err = json.Unmarshal(bytes, &all) if err != nil { +||||||| parent of 04c075be8 (Remove required unmarshal in models) + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.End == nil { + return fmt.Errorf("required field end missing") + } + if required.Id == nil { + return fmt.Errorf("required field id missing") + } + if required.Level == nil { + return fmt.Errorf("required field level missing") + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.PipelineName == nil { + return fmt.Errorf("required field pipeline_name missing") + } + if required.PipelineUniqueId == nil { + return fmt.Errorf("required field pipeline_unique_id missing") + } + if required.Start == nil { + return fmt.Errorf("required field start missing") + } + if required.Status == nil { + return fmt.Errorf("required field status missing") + } + if required.Url == nil { + return fmt.Errorf("required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { +======= + if err = json.Unmarshal(bytes, &all); err != nil { +>>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -797,6 +868,33 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.End == nil { + return fmt.Errorf("required field end missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Level == nil { + return fmt.Errorf("required field level missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.PipelineName == nil { + return fmt.Errorf("required field pipeline_name missing") + } + if all.PipelineUniqueId == nil { + return fmt.Errorf("required field pipeline_unique_id missing") + } + if all.Start == nil { + return fmt.Errorf("required field start missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"dependencies", "end", "error", "git", "id", "level", "metrics", "name", "node", "parameters", "pipeline_name", "pipeline_unique_id", "queue_time", "stage_id", "stage_name", "start", "status", "tags", "url"}) @@ -820,24 +918,32 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Dependencies = all.Dependencies - o.End = all.End + o.End = *all.End o.Error = all.Error o.Git = all.Git - o.Id = all.Id - o.Level = all.Level + o.Id = *all.Id + o.Level = *all.Level o.Metrics = all.Metrics - o.Name = all.Name + o.Name = *all.Name o.Node = all.Node o.Parameters = all.Parameters - o.PipelineName = all.PipelineName - o.PipelineUniqueId = all.PipelineUniqueId + o.PipelineName = *all.PipelineName + o.PipelineUniqueId = *all.PipelineUniqueId o.QueueTime = all.QueueTime o.StageId = all.StageId o.StageName = all.StageName - o.Start = all.Start - o.Status = all.Status + o.Start = *all.Start + o.Status = *all.Status o.Tags = all.Tags +<<<<<<< HEAD + o.Url = all.Url +||||||| parent of 04c075be8 (Remove required unmarshal in models) o.Url = all.Url + o.User = all.User +======= + o.Url = *all.Url + o.User = all.User +>>>>>>> 04c075be8 (Remove required unmarshal in models) if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go b/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go index 527bf4c29eb..f9ac1ddd474 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go +++ b/api/datadogV2/model_ci_app_pipeline_event_parent_pipeline.go @@ -111,22 +111,11 @@ func (o CIAppPipelineEventParentPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventParentPipeline) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - }{} all := struct { - Id string `json:"id"` + Id *string `json:"id"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *CIAppPipelineEventParentPipeline) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "url"}) } else { return err } - o.Id = all.Id + o.Id = *all.Id o.Url = all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_ci_app_pipeline_event_pipeline.go b/api/datadogV2/model_ci_app_pipeline_event_pipeline.go index 745e1330f49..40adeaed2ff 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_pipeline.go +++ b/api/datadogV2/model_ci_app_pipeline_event_pipeline.go @@ -774,6 +774,7 @@ func (o CIAppPipelineEventPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} +<<<<<<< HEAD required := struct { End *time.Time `json:"end"` Git NullableCIAppGitInfo `json:"git"` @@ -785,28 +786,52 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { UniqueId *string `json:"unique_id"` Url *string `json:"url"` }{} +||||||| parent of 04c075be8 (Remove required unmarshal in models) + required := struct { + End *time.Time `json:"end"` + Level *CIAppPipelineEventPipelineLevel `json:"level"` + Name *string `json:"name"` + PartialRetry *bool `json:"partial_retry"` + Start *time.Time `json:"start"` + Status *CIAppPipelineEventPipelineStatus `json:"status"` + UniqueId *string `json:"unique_id"` + Url *string `json:"url"` + }{} +======= +>>>>>>> 04c075be8 (Remove required unmarshal in models) all := struct { - End time.Time `json:"end"` + End *time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` Git NullableCIAppGitInfo `json:"git"` IsManual datadog.NullableBool `json:"is_manual,omitempty"` IsResumed datadog.NullableBool `json:"is_resumed,omitempty"` - Level CIAppPipelineEventPipelineLevel `json:"level"` + Level *CIAppPipelineEventPipelineLevel `json:"level"` Metrics datadog.NullableList[string] `json:"metrics,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Node NullableCIAppHostInfo `json:"node,omitempty"` Parameters map[string]string `json:"parameters,omitempty"` ParentPipeline NullableCIAppPipelineEventParentPipeline `json:"parent_pipeline,omitempty"` - PartialRetry bool `json:"partial_retry"` + PartialRetry *bool `json:"partial_retry"` PipelineId *string `json:"pipeline_id,omitempty"` PreviousAttempt NullableCIAppPipelineEventPreviousPipeline `json:"previous_attempt,omitempty"` QueueTime datadog.NullableInt64 `json:"queue_time,omitempty"` - Start time.Time `json:"start"` - Status CIAppPipelineEventPipelineStatus `json:"status"` + Start *time.Time `json:"start"` + Status *CIAppPipelineEventPipelineStatus `json:"status"` Tags datadog.NullableList[string] `json:"tags,omitempty"` +<<<<<<< HEAD + UniqueId string `json:"unique_id"` + Url string `json:"url"` +||||||| parent of 04c075be8 (Remove required unmarshal in models) UniqueId string `json:"unique_id"` Url string `json:"url"` + User NullableCIAppUserInfo `json:"user,omitempty"` +======= + UniqueId *string `json:"unique_id"` + Url *string `json:"url"` + User NullableCIAppUserInfo `json:"user,omitempty"` +>>>>>>> 04c075be8 (Remove required unmarshal in models) }{} +<<<<<<< HEAD err = json.Unmarshal(bytes, &required) if err != nil { return err @@ -840,6 +865,40 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { } err = json.Unmarshal(bytes, &all) if err != nil { +||||||| parent of 04c075be8 (Remove required unmarshal in models) + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.End == nil { + return fmt.Errorf("required field end missing") + } + if required.Level == nil { + return fmt.Errorf("required field level missing") + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.PartialRetry == nil { + return fmt.Errorf("required field partial_retry missing") + } + if required.Start == nil { + return fmt.Errorf("required field start missing") + } + if required.Status == nil { + return fmt.Errorf("required field status missing") + } + if required.UniqueId == nil { + return fmt.Errorf("required field unique_id missing") + } + if required.Url == nil { + return fmt.Errorf("required field url missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { +======= + if err = json.Unmarshal(bytes, &all); err != nil { +>>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -847,6 +906,30 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.End == nil { + return fmt.Errorf("required field end missing") + } + if all.Level == nil { + return fmt.Errorf("required field level missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.PartialRetry == nil { + return fmt.Errorf("required field partial_retry missing") + } + if all.Start == nil { + return fmt.Errorf("required field start missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } + if all.UniqueId == nil { + return fmt.Errorf("required field unique_id missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"end", "error", "git", "is_manual", "is_resumed", "level", "metrics", "name", "node", "parameters", "parent_pipeline", "partial_retry", "pipeline_id", "previous_attempt", "queue_time", "start", "status", "tags", "unique_id", "url"}) @@ -869,26 +952,36 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.End = all.End + o.End = *all.End o.Error = all.Error o.Git = all.Git o.IsManual = all.IsManual o.IsResumed = all.IsResumed - o.Level = all.Level + o.Level = *all.Level o.Metrics = all.Metrics - o.Name = all.Name + o.Name = *all.Name o.Node = all.Node o.Parameters = all.Parameters o.ParentPipeline = all.ParentPipeline - o.PartialRetry = all.PartialRetry + o.PartialRetry = *all.PartialRetry o.PipelineId = all.PipelineId o.PreviousAttempt = all.PreviousAttempt o.QueueTime = all.QueueTime - o.Start = all.Start - o.Status = all.Status + o.Start = *all.Start + o.Status = *all.Status o.Tags = all.Tags +<<<<<<< HEAD + o.UniqueId = all.UniqueId + o.Url = all.Url +||||||| parent of 04c075be8 (Remove required unmarshal in models) o.UniqueId = all.UniqueId o.Url = all.Url + o.User = all.User +======= + o.UniqueId = *all.UniqueId + o.Url = *all.Url + o.User = all.User +>>>>>>> 04c075be8 (Remove required unmarshal in models) if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go b/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go index aff545cbada..6ccc9107bcc 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go +++ b/api/datadogV2/model_ci_app_pipeline_event_previous_pipeline.go @@ -111,22 +111,11 @@ func (o CIAppPipelineEventPreviousPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventPreviousPipeline) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - }{} all := struct { - Id string `json:"id"` + Id *string `json:"id"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *CIAppPipelineEventPreviousPipeline) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "url"}) } else { return err } - o.Id = all.Id + o.Id = *all.Id o.Url = all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_ci_app_pipeline_event_stage.go b/api/datadogV2/model_ci_app_pipeline_event_stage.go index c272c008e18..0d4be6ee16e 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_stage.go +++ b/api/datadogV2/model_ci_app_pipeline_event_stage.go @@ -606,17 +606,31 @@ func (o CIAppPipelineEventStage) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { + Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` End *time.Time `json:"end"` +<<<<<<< HEAD Git NullableCIAppGitInfo `json:"git"` +||||||| parent of 04c075be8 (Remove required unmarshal in models) +======= + Error NullableCIAppCIError `json:"error,omitempty"` + Git NullableCIAppGitInfo `json:"git,omitempty"` +>>>>>>> 04c075be8 (Remove required unmarshal in models) Id *string `json:"id"` Level *CIAppPipelineEventStageLevel `json:"level"` + Metrics datadog.NullableList[string] `json:"metrics,omitempty"` Name *string `json:"name"` + Node NullableCIAppHostInfo `json:"node,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` PipelineName *string `json:"pipeline_name"` PipelineUniqueId *string `json:"pipeline_unique_id"` + QueueTime datadog.NullableInt64 `json:"queue_time,omitempty"` Start *time.Time `json:"start"` Status *CIAppPipelineEventStageStatus `json:"status"` + Tags datadog.NullableList[string] `json:"tags,omitempty"` + User NullableCIAppUserInfo `json:"user,omitempty"` }{} +<<<<<<< HEAD all := struct { Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` End time.Time `json:"end"` @@ -668,6 +682,59 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { } err = json.Unmarshal(bytes, &all) if err != nil { +||||||| parent of 04c075be8 (Remove required unmarshal in models) + all := struct { + Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` + End time.Time `json:"end"` + Error NullableCIAppCIError `json:"error,omitempty"` + Git NullableCIAppGitInfo `json:"git,omitempty"` + Id string `json:"id"` + Level CIAppPipelineEventStageLevel `json:"level"` + Metrics datadog.NullableList[string] `json:"metrics,omitempty"` + Name string `json:"name"` + Node NullableCIAppHostInfo `json:"node,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` + PipelineName string `json:"pipeline_name"` + PipelineUniqueId string `json:"pipeline_unique_id"` + QueueTime datadog.NullableInt64 `json:"queue_time,omitempty"` + Start time.Time `json:"start"` + Status CIAppPipelineEventStageStatus `json:"status"` + Tags datadog.NullableList[string] `json:"tags,omitempty"` + User NullableCIAppUserInfo `json:"user,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.End == nil { + return fmt.Errorf("required field end missing") + } + if required.Id == nil { + return fmt.Errorf("required field id missing") + } + if required.Level == nil { + return fmt.Errorf("required field level missing") + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.PipelineName == nil { + return fmt.Errorf("required field pipeline_name missing") + } + if required.PipelineUniqueId == nil { + return fmt.Errorf("required field pipeline_unique_id missing") + } + if required.Start == nil { + return fmt.Errorf("required field start missing") + } + if required.Status == nil { + return fmt.Errorf("required field status missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { +======= + if err = json.Unmarshal(bytes, &all); err != nil { +>>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -675,6 +742,30 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.End == nil { + return fmt.Errorf("required field end missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Level == nil { + return fmt.Errorf("required field level missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.PipelineName == nil { + return fmt.Errorf("required field pipeline_name missing") + } + if all.PipelineUniqueId == nil { + return fmt.Errorf("required field pipeline_unique_id missing") + } + if all.Start == nil { + return fmt.Errorf("required field start missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"dependencies", "end", "error", "git", "id", "level", "metrics", "name", "node", "parameters", "pipeline_name", "pipeline_unique_id", "queue_time", "start", "status", "tags"}) @@ -698,20 +789,20 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Dependencies = all.Dependencies - o.End = all.End + o.End = *all.End o.Error = all.Error o.Git = all.Git - o.Id = all.Id - o.Level = all.Level + o.Id = *all.Id + o.Level = *all.Level o.Metrics = all.Metrics - o.Name = all.Name + o.Name = *all.Name o.Node = all.Node o.Parameters = all.Parameters - o.PipelineName = all.PipelineName - o.PipelineUniqueId = all.PipelineUniqueId + o.PipelineName = *all.PipelineName + o.PipelineUniqueId = *all.PipelineUniqueId o.QueueTime = all.QueueTime - o.Start = all.Start - o.Status = all.Status + o.Start = *all.Start + o.Status = *all.Status o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_ci_app_pipeline_event_step.go b/api/datadogV2/model_ci_app_pipeline_event_step.go index 6d60d447073..937c03ba13c 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_step.go +++ b/api/datadogV2/model_ci_app_pipeline_event_step.go @@ -738,17 +738,34 @@ func (o CIAppPipelineEventStep) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { End *time.Time `json:"end"` +<<<<<<< HEAD Git NullableCIAppGitInfo `json:"git"` +||||||| parent of 04c075be8 (Remove required unmarshal in models) +======= + Error NullableCIAppCIError `json:"error,omitempty"` + Git NullableCIAppGitInfo `json:"git,omitempty"` +>>>>>>> 04c075be8 (Remove required unmarshal in models) Id *string `json:"id"` + JobId datadog.NullableString `json:"job_id,omitempty"` + JobName datadog.NullableString `json:"job_name,omitempty"` Level *CIAppPipelineEventStepLevel `json:"level"` + Metrics datadog.NullableList[string] `json:"metrics,omitempty"` Name *string `json:"name"` + Node NullableCIAppHostInfo `json:"node,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` PipelineName *string `json:"pipeline_name"` PipelineUniqueId *string `json:"pipeline_unique_id"` + StageId datadog.NullableString `json:"stage_id,omitempty"` + StageName datadog.NullableString `json:"stage_name,omitempty"` Start *time.Time `json:"start"` Status *CIAppPipelineEventStepStatus `json:"status"` + Tags datadog.NullableList[string] `json:"tags,omitempty"` + Url datadog.NullableString `json:"url,omitempty"` + User NullableCIAppUserInfo `json:"user,omitempty"` }{} +<<<<<<< HEAD all := struct { End time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` @@ -803,6 +820,62 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { } err = json.Unmarshal(bytes, &all) if err != nil { +||||||| parent of 04c075be8 (Remove required unmarshal in models) + all := struct { + End time.Time `json:"end"` + Error NullableCIAppCIError `json:"error,omitempty"` + Git NullableCIAppGitInfo `json:"git,omitempty"` + Id string `json:"id"` + JobId datadog.NullableString `json:"job_id,omitempty"` + JobName datadog.NullableString `json:"job_name,omitempty"` + Level CIAppPipelineEventStepLevel `json:"level"` + Metrics datadog.NullableList[string] `json:"metrics,omitempty"` + Name string `json:"name"` + Node NullableCIAppHostInfo `json:"node,omitempty"` + Parameters map[string]string `json:"parameters,omitempty"` + PipelineName string `json:"pipeline_name"` + PipelineUniqueId string `json:"pipeline_unique_id"` + StageId datadog.NullableString `json:"stage_id,omitempty"` + StageName datadog.NullableString `json:"stage_name,omitempty"` + Start time.Time `json:"start"` + Status CIAppPipelineEventStepStatus `json:"status"` + Tags datadog.NullableList[string] `json:"tags,omitempty"` + Url datadog.NullableString `json:"url,omitempty"` + User NullableCIAppUserInfo `json:"user,omitempty"` + }{} + err = json.Unmarshal(bytes, &required) + if err != nil { + return err + } + if required.End == nil { + return fmt.Errorf("required field end missing") + } + if required.Id == nil { + return fmt.Errorf("required field id missing") + } + if required.Level == nil { + return fmt.Errorf("required field level missing") + } + if required.Name == nil { + return fmt.Errorf("required field name missing") + } + if required.PipelineName == nil { + return fmt.Errorf("required field pipeline_name missing") + } + if required.PipelineUniqueId == nil { + return fmt.Errorf("required field pipeline_unique_id missing") + } + if required.Start == nil { + return fmt.Errorf("required field start missing") + } + if required.Status == nil { + return fmt.Errorf("required field status missing") + } + err = json.Unmarshal(bytes, &all) + if err != nil { +======= + if err = json.Unmarshal(bytes, &all); err != nil { +>>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -810,6 +883,30 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.End == nil { + return fmt.Errorf("required field end missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Level == nil { + return fmt.Errorf("required field level missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.PipelineName == nil { + return fmt.Errorf("required field pipeline_name missing") + } + if all.PipelineUniqueId == nil { + return fmt.Errorf("required field pipeline_unique_id missing") + } + if all.Start == nil { + return fmt.Errorf("required field start missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"end", "error", "git", "id", "job_id", "job_name", "level", "metrics", "name", "node", "parameters", "pipeline_name", "pipeline_unique_id", "stage_id", "stage_name", "start", "status", "tags", "url"}) @@ -832,23 +929,23 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.End = all.End + o.End = *all.End o.Error = all.Error o.Git = all.Git - o.Id = all.Id + o.Id = *all.Id o.JobId = all.JobId o.JobName = all.JobName - o.Level = all.Level + o.Level = *all.Level o.Metrics = all.Metrics - o.Name = all.Name + o.Name = *all.Name o.Node = all.Node o.Parameters = all.Parameters - o.PipelineName = all.PipelineName - o.PipelineUniqueId = all.PipelineUniqueId + o.PipelineName = *all.PipelineName + o.PipelineUniqueId = *all.PipelineUniqueId o.StageId = all.StageId o.StageName = all.StageName - o.Start = all.Start - o.Status = all.Status + o.Start = *all.Start + o.Status = *all.Status o.Tags = all.Tags o.Url = all.Url if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_ci_app_pipeline_events_request.go b/api/datadogV2/model_ci_app_pipeline_events_request.go index b7cfdfc2dbb..76abf3428ff 100644 --- a/api/datadogV2/model_ci_app_pipeline_events_request.go +++ b/api/datadogV2/model_ci_app_pipeline_events_request.go @@ -189,8 +189,7 @@ func (o *CIAppPipelineEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Page *CIAppQueryPageOptions `json:"page,omitempty"` Sort *CIAppSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipeline_events_response.go b/api/datadogV2/model_ci_app_pipeline_events_response.go index 0a44d0df34c..2b1ee9baf36 100644 --- a/api/datadogV2/model_ci_app_pipeline_events_response.go +++ b/api/datadogV2/model_ci_app_pipeline_events_response.go @@ -154,8 +154,7 @@ func (o *CIAppPipelineEventsResponse) UnmarshalJSON(bytes []byte) (err error) { Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadataWithPagination `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipelines_aggregate_request.go b/api/datadogV2/model_ci_app_pipelines_aggregate_request.go index f1eaad9233e..513eb43572a 100644 --- a/api/datadogV2/model_ci_app_pipelines_aggregate_request.go +++ b/api/datadogV2/model_ci_app_pipelines_aggregate_request.go @@ -189,8 +189,7 @@ func (o *CIAppPipelinesAggregateRequest) UnmarshalJSON(bytes []byte) (err error) GroupBy []CIAppPipelinesGroupBy `json:"group_by,omitempty"` Options *CIAppQueryOptions `json:"options,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go b/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go index fd69d4fd7e8..ede53ae100f 100644 --- a/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go +++ b/api/datadogV2/model_ci_app_pipelines_aggregation_buckets_response.go @@ -86,8 +86,7 @@ func (o *CIAppPipelinesAggregationBucketsResponse) UnmarshalJSON(bytes []byte) ( all := struct { Buckets []CIAppPipelinesBucketResponse `json:"buckets,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go b/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go index a9846c36d77..06567c9003d 100644 --- a/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go +++ b/api/datadogV2/model_ci_app_pipelines_analytics_aggregate_response.go @@ -154,8 +154,7 @@ func (o *CIAppPipelinesAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) ( Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipelines_bucket_response.go b/api/datadogV2/model_ci_app_pipelines_bucket_response.go index cce8df48e96..afdef7b8fa5 100644 --- a/api/datadogV2/model_ci_app_pipelines_bucket_response.go +++ b/api/datadogV2/model_ci_app_pipelines_bucket_response.go @@ -120,8 +120,7 @@ func (o *CIAppPipelinesBucketResponse) UnmarshalJSON(bytes []byte) (err error) { By map[string]interface{} `json:"by,omitempty"` Computes map[string]CIAppAggregateBucketValue `json:"computes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_pipelines_group_by.go b/api/datadogV2/model_ci_app_pipelines_group_by.go index 359e84efac6..17f9f031e36 100644 --- a/api/datadogV2/model_ci_app_pipelines_group_by.go +++ b/api/datadogV2/model_ci_app_pipelines_group_by.go @@ -248,26 +248,15 @@ func (o CIAppPipelinesGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelinesGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Histogram *CIAppGroupByHistogram `json:"histogram,omitempty"` Limit *int64 `json:"limit,omitempty"` Missing *CIAppGroupByMissing `json:"missing,omitempty"` Sort *CIAppAggregateSort `json:"sort,omitempty"` Total *CIAppGroupByTotal `json:"total,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -275,13 +264,16 @@ func (o *CIAppPipelinesGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "histogram", "limit", "missing", "sort", "total"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_ci_app_pipelines_query_filter.go b/api/datadogV2/model_ci_app_pipelines_query_filter.go index 96a69f18fb5..dfb9415744e 100644 --- a/api/datadogV2/model_ci_app_pipelines_query_filter.go +++ b/api/datadogV2/model_ci_app_pipelines_query_filter.go @@ -166,8 +166,7 @@ func (o *CIAppPipelinesQueryFilter) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_query_options.go b/api/datadogV2/model_ci_app_query_options.go index 89c6df28e88..91e27534278 100644 --- a/api/datadogV2/model_ci_app_query_options.go +++ b/api/datadogV2/model_ci_app_query_options.go @@ -125,8 +125,7 @@ func (o *CIAppQueryOptions) UnmarshalJSON(bytes []byte) (err error) { TimeOffset *int64 `json:"time_offset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_query_page_options.go b/api/datadogV2/model_ci_app_query_page_options.go index bf211424433..8baa11727a9 100644 --- a/api/datadogV2/model_ci_app_query_page_options.go +++ b/api/datadogV2/model_ci_app_query_page_options.go @@ -124,8 +124,7 @@ func (o *CIAppQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_response_links.go b/api/datadogV2/model_ci_app_response_links.go index dfe76be3e1a..7b8e258108e 100644 --- a/api/datadogV2/model_ci_app_response_links.go +++ b/api/datadogV2/model_ci_app_response_links.go @@ -87,8 +87,7 @@ func (o *CIAppResponseLinks) UnmarshalJSON(bytes []byte) (err error) { all := struct { Next *string `json:"next,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_response_metadata.go b/api/datadogV2/model_ci_app_response_metadata.go index 55c2790f48e..6beb88a04eb 100644 --- a/api/datadogV2/model_ci_app_response_metadata.go +++ b/api/datadogV2/model_ci_app_response_metadata.go @@ -189,8 +189,7 @@ func (o *CIAppResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Status *CIAppResponseStatus `json:"status,omitempty"` Warnings []CIAppWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_response_metadata_with_pagination.go b/api/datadogV2/model_ci_app_response_metadata_with_pagination.go index 1f415377658..7c24c83f9c2 100644 --- a/api/datadogV2/model_ci_app_response_metadata_with_pagination.go +++ b/api/datadogV2/model_ci_app_response_metadata_with_pagination.go @@ -223,8 +223,7 @@ func (o *CIAppResponseMetadataWithPagination) UnmarshalJSON(bytes []byte) (err e Status *CIAppResponseStatus `json:"status,omitempty"` Warnings []CIAppWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_response_page.go b/api/datadogV2/model_ci_app_response_page.go index a4dfb478ec5..750cbf2ee3d 100644 --- a/api/datadogV2/model_ci_app_response_page.go +++ b/api/datadogV2/model_ci_app_response_page.go @@ -86,8 +86,7 @@ func (o *CIAppResponsePage) UnmarshalJSON(bytes []byte) (err error) { all := struct { After *string `json:"after,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_test_event.go b/api/datadogV2/model_ci_app_test_event.go index 394c782a76e..3b899546994 100644 --- a/api/datadogV2/model_ci_app_test_event.go +++ b/api/datadogV2/model_ci_app_test_event.go @@ -154,8 +154,7 @@ func (o *CIAppTestEvent) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *CIAppTestEventTypeName `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_test_events_request.go b/api/datadogV2/model_ci_app_test_events_request.go index a5898400ec0..e83c912508d 100644 --- a/api/datadogV2/model_ci_app_test_events_request.go +++ b/api/datadogV2/model_ci_app_test_events_request.go @@ -189,8 +189,7 @@ func (o *CIAppTestEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Page *CIAppQueryPageOptions `json:"page,omitempty"` Sort *CIAppSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_test_events_response.go b/api/datadogV2/model_ci_app_test_events_response.go index 778bc58f4f8..2510de3bdb8 100644 --- a/api/datadogV2/model_ci_app_test_events_response.go +++ b/api/datadogV2/model_ci_app_test_events_response.go @@ -154,8 +154,7 @@ func (o *CIAppTestEventsResponse) UnmarshalJSON(bytes []byte) (err error) { Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadataWithPagination `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_tests_aggregate_request.go b/api/datadogV2/model_ci_app_tests_aggregate_request.go index ff24352d5bf..3fe4db5a7bf 100644 --- a/api/datadogV2/model_ci_app_tests_aggregate_request.go +++ b/api/datadogV2/model_ci_app_tests_aggregate_request.go @@ -189,8 +189,7 @@ func (o *CIAppTestsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { GroupBy []CIAppTestsGroupBy `json:"group_by,omitempty"` Options *CIAppQueryOptions `json:"options,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go b/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go index 95bc0e60939..89a19dadf86 100644 --- a/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go +++ b/api/datadogV2/model_ci_app_tests_aggregation_buckets_response.go @@ -86,8 +86,7 @@ func (o *CIAppTestsAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err all := struct { Buckets []CIAppTestsBucketResponse `json:"buckets,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go b/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go index 8121b68173e..70658cc717a 100644 --- a/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go +++ b/api/datadogV2/model_ci_app_tests_analytics_aggregate_response.go @@ -154,8 +154,7 @@ func (o *CIAppTestsAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err Links *CIAppResponseLinks `json:"links,omitempty"` Meta *CIAppResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_tests_bucket_response.go b/api/datadogV2/model_ci_app_tests_bucket_response.go index bee4070a159..6f989a32467 100644 --- a/api/datadogV2/model_ci_app_tests_bucket_response.go +++ b/api/datadogV2/model_ci_app_tests_bucket_response.go @@ -120,8 +120,7 @@ func (o *CIAppTestsBucketResponse) UnmarshalJSON(bytes []byte) (err error) { By map[string]interface{} `json:"by,omitempty"` Computes map[string]CIAppAggregateBucketValue `json:"computes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_tests_group_by.go b/api/datadogV2/model_ci_app_tests_group_by.go index bb95d607af0..166474ece7a 100644 --- a/api/datadogV2/model_ci_app_tests_group_by.go +++ b/api/datadogV2/model_ci_app_tests_group_by.go @@ -248,26 +248,15 @@ func (o CIAppTestsGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppTestsGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Histogram *CIAppGroupByHistogram `json:"histogram,omitempty"` Limit *int64 `json:"limit,omitempty"` Missing *CIAppGroupByMissing `json:"missing,omitempty"` Sort *CIAppAggregateSort `json:"sort,omitempty"` Total *CIAppGroupByTotal `json:"total,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -275,13 +264,16 @@ func (o *CIAppTestsGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "histogram", "limit", "missing", "sort", "total"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_ci_app_tests_query_filter.go b/api/datadogV2/model_ci_app_tests_query_filter.go index 74727ab5db6..ba3c26f3e07 100644 --- a/api/datadogV2/model_ci_app_tests_query_filter.go +++ b/api/datadogV2/model_ci_app_tests_query_filter.go @@ -166,8 +166,7 @@ func (o *CIAppTestsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ci_app_user_info.go b/api/datadogV2/model_ci_app_user_info.go new file mode 100644 index 00000000000..ad0dd855172 --- /dev/null +++ b/api/datadogV2/model_ci_app_user_info.go @@ -0,0 +1,195 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "encoding/json" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CIAppUserInfo Used to specify user-related information when the payload does not have Git information. +// For example, if Git information is missing for manually triggered pipelines, this field can be used instead. +type CIAppUserInfo struct { + // Email of the user. + Email *string `json:"email,omitempty"` + // Name of the user. + Name *string `json:"name,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewCIAppUserInfo instantiates a new CIAppUserInfo object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCIAppUserInfo() *CIAppUserInfo { + this := CIAppUserInfo{} + return &this +} + +// NewCIAppUserInfoWithDefaults instantiates a new CIAppUserInfo object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCIAppUserInfoWithDefaults() *CIAppUserInfo { + this := CIAppUserInfo{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *CIAppUserInfo) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CIAppUserInfo) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *CIAppUserInfo) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *CIAppUserInfo) SetEmail(v string) { + o.Email = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CIAppUserInfo) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CIAppUserInfo) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CIAppUserInfo) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CIAppUserInfo) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CIAppUserInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CIAppUserInfo) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + }{} + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + additionalProperties := make(map[string]interface{}) + if err = json.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"email", "name"}) + } else { + return err + } + o.Email = all.Email + o.Name = all.Name + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} + +// NullableCIAppUserInfo handles when a null is used for CIAppUserInfo. +type NullableCIAppUserInfo struct { + value *CIAppUserInfo + isSet bool +} + +// Get returns the associated value. +func (v NullableCIAppUserInfo) Get() *CIAppUserInfo { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableCIAppUserInfo) Set(val *CIAppUserInfo) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableCIAppUserInfo) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableCIAppUserInfo) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableCIAppUserInfo initializes the struct as if Set has been called. +func NewNullableCIAppUserInfo(val *CIAppUserInfo) *NullableCIAppUserInfo { + return &NullableCIAppUserInfo{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableCIAppUserInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableCIAppUserInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return json.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_ci_app_warning.go b/api/datadogV2/model_ci_app_warning.go index 8f7bfc0c86f..ef742761e16 100644 --- a/api/datadogV2/model_ci_app_warning.go +++ b/api/datadogV2/model_ci_app_warning.go @@ -154,8 +154,7 @@ func (o *CIAppWarning) UnmarshalJSON(bytes []byte) (err error) { Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_configuration_compliance_rule_options.go b/api/datadogV2/model_cloud_configuration_compliance_rule_options.go index e29eb6c904a..9fb7179ccb7 100644 --- a/api/datadogV2/model_cloud_configuration_compliance_rule_options.go +++ b/api/datadogV2/model_cloud_configuration_compliance_rule_options.go @@ -159,8 +159,7 @@ func (o *CloudConfigurationComplianceRuleOptions) UnmarshalJSON(bytes []byte) (e RegoRule *CloudConfigurationRegoRule `json:"regoRule,omitempty"` ResourceType *string `json:"resourceType,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_configuration_rego_rule.go b/api/datadogV2/model_cloud_configuration_rego_rule.go index 94238a2c794..fc787a95e88 100644 --- a/api/datadogV2/model_cloud_configuration_rego_rule.go +++ b/api/datadogV2/model_cloud_configuration_rego_rule.go @@ -105,26 +105,11 @@ func (o CloudConfigurationRegoRule) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRegoRule) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Policy *string `json:"policy"` ResourceTypes *[]string `json:"resourceTypes"` }{} - all := struct { - Policy string `json:"policy"` - ResourceTypes []string `json:"resourceTypes"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Policy == nil { - return fmt.Errorf("required field policy missing") - } - if required.ResourceTypes == nil { - return fmt.Errorf("required field resourceTypes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *CloudConfigurationRegoRule) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Policy == nil { + return fmt.Errorf("required field policy missing") + } + if all.ResourceTypes == nil { + return fmt.Errorf("required field resourceTypes missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"policy", "resourceTypes"}) } else { return err } - o.Policy = all.Policy - o.ResourceTypes = all.ResourceTypes + o.Policy = *all.Policy + o.ResourceTypes = *all.ResourceTypes if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_configuration_rule_case_create.go b/api/datadogV2/model_cloud_configuration_rule_case_create.go index a768a1f8b27..72bb6b4c554 100644 --- a/api/datadogV2/model_cloud_configuration_rule_case_create.go +++ b/api/datadogV2/model_cloud_configuration_rule_case_create.go @@ -111,22 +111,11 @@ func (o CloudConfigurationRuleCaseCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleCaseCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Status *SecurityMonitoringRuleSeverity `json:"status"` - }{} all := struct { - Notifications []string `json:"notifications,omitempty"` - Status SecurityMonitoringRuleSeverity `json:"status"` + Notifications []string `json:"notifications,omitempty"` + Status *SecurityMonitoringRuleSeverity `json:"status"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *CloudConfigurationRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"notifications", "status"}) @@ -149,7 +141,7 @@ func (o *CloudConfigurationRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro return nil } o.Notifications = all.Notifications - o.Status = all.Status + o.Status = *all.Status if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go b/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go index a885ea0875c..8aad1ad4b6e 100644 --- a/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go +++ b/api/datadogV2/model_cloud_configuration_rule_compliance_signal_options.go @@ -142,8 +142,7 @@ func (o *CloudConfigurationRuleComplianceSignalOptions) UnmarshalJSON(bytes []by UserActivationStatus datadog.NullableBool `json:"userActivationStatus,omitempty"` UserGroupByFields datadog.NullableList[string] `json:"userGroupByFields,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_configuration_rule_create_payload.go b/api/datadogV2/model_cloud_configuration_rule_create_payload.go index 6a704c649c7..3452110a44b 100644 --- a/api/datadogV2/model_cloud_configuration_rule_create_payload.go +++ b/api/datadogV2/model_cloud_configuration_rule_create_payload.go @@ -280,55 +280,42 @@ func (o CloudConfigurationRuleCreatePayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Cases *[]CloudConfigurationRuleCaseCreate `json:"cases"` ComplianceSignalOptions *CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions"` IsEnabled *bool `json:"isEnabled"` Message *string `json:"message"` Name *string `json:"name"` Options *CloudConfigurationRuleOptions `json:"options"` + Tags []string `json:"tags,omitempty"` + Type *CloudConfigurationRuleType `json:"type,omitempty"` }{} - all := struct { - Cases []CloudConfigurationRuleCaseCreate `json:"cases"` - ComplianceSignalOptions CloudConfigurationRuleComplianceSignalOptions `json:"complianceSignalOptions"` - IsEnabled bool `json:"isEnabled"` - Message string `json:"message"` - Name string `json:"name"` - Options CloudConfigurationRuleOptions `json:"options"` - Tags []string `json:"tags,omitempty"` - Type *CloudConfigurationRuleType `json:"type,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Cases == nil { + if all.Cases == nil { return fmt.Errorf("required field cases missing") } - if required.ComplianceSignalOptions == nil { + if all.ComplianceSignalOptions == nil { return fmt.Errorf("required field complianceSignalOptions missing") } - if required.IsEnabled == nil { + if all.IsEnabled == nil { return fmt.Errorf("required field isEnabled missing") } - if required.Message == nil { + if all.Message == nil { return fmt.Errorf("required field message missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Options == nil { + if all.Options == nil { return fmt.Errorf("required field options missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"cases", "complianceSignalOptions", "isEnabled", "message", "name", "options", "tags", "type"}) @@ -343,7 +330,7 @@ func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } - o.Cases = all.Cases + o.Cases = *all.Cases if all.ComplianceSignalOptions.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -351,10 +338,10 @@ func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err e } o.UnparsedObject = raw } - o.ComplianceSignalOptions = all.ComplianceSignalOptions - o.IsEnabled = all.IsEnabled - o.Message = all.Message - o.Name = all.Name + o.ComplianceSignalOptions = *all.ComplianceSignalOptions + o.IsEnabled = *all.IsEnabled + o.Message = *all.Message + o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -362,7 +349,7 @@ func (o *CloudConfigurationRuleCreatePayload) UnmarshalJSON(bytes []byte) (err e } o.UnparsedObject = raw } - o.Options = all.Options + o.Options = *all.Options o.Tags = all.Tags o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_cloud_configuration_rule_options.go b/api/datadogV2/model_cloud_configuration_rule_options.go index ae406c5e7ff..c32c691b3c3 100644 --- a/api/datadogV2/model_cloud_configuration_rule_options.go +++ b/api/datadogV2/model_cloud_configuration_rule_options.go @@ -80,21 +80,10 @@ func (o CloudConfigurationRuleOptions) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudConfigurationRuleOptions) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ComplianceRuleOptions *CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions"` - }{} all := struct { - ComplianceRuleOptions CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions"` + ComplianceRuleOptions *CloudConfigurationComplianceRuleOptions `json:"complianceRuleOptions"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ComplianceRuleOptions == nil { - return fmt.Errorf("required field complianceRuleOptions missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -102,6 +91,9 @@ func (o *CloudConfigurationRuleOptions) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.ComplianceRuleOptions == nil { + return fmt.Errorf("required field complianceRuleOptions missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"complianceRuleOptions"}) @@ -115,7 +107,7 @@ func (o *CloudConfigurationRuleOptions) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.ComplianceRuleOptions = all.ComplianceRuleOptions + o.ComplianceRuleOptions = *all.ComplianceRuleOptions if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go b/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go index a683672b9eb..eabdeae8583 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_attributes.go @@ -426,8 +426,7 @@ func (o *CloudWorkloadSecurityAgentRuleAttributes) UnmarshalJSON(bytes []byte) ( Updater *CloudWorkloadSecurityAgentRuleUpdaterAttributes `json:"updater,omitempty"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go b/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go index 44118f3478b..d5527c798a9 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go @@ -171,28 +171,13 @@ func (o CloudWorkloadSecurityAgentRuleCreateAttributes) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Expression *string `json:"expression"` - Name *string `json:"name"` - }{} all := struct { Description *string `json:"description,omitempty"` Enabled *bool `json:"enabled,omitempty"` - Expression string `json:"expression"` - Name string `json:"name"` + Expression *string `json:"expression"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Expression == nil { - return fmt.Errorf("required field expression missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +185,12 @@ func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []b o.UnparsedObject = raw return nil } + if all.Expression == nil { + return fmt.Errorf("required field expression missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"description", "enabled", "expression", "name"}) @@ -208,8 +199,8 @@ func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []b } o.Description = all.Description o.Enabled = all.Enabled - o.Expression = all.Expression - o.Name = all.Name + o.Expression = *all.Expression + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go b/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go index 425e6056363..d29b5ea9431 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_create_data.go @@ -107,26 +107,11 @@ func (o CloudWorkloadSecurityAgentRuleCreateData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` Type *CloudWorkloadSecurityAgentRuleType `json:"type"` }{} - all := struct { - Attributes CloudWorkloadSecurityAgentRuleCreateAttributes `json:"attributes"` - Type CloudWorkloadSecurityAgentRuleType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *CloudWorkloadSecurityAgentRuleCreateData) UnmarshalJSON(bytes []byte) ( } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go b/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go index 8e623088fda..ad63b84ac2c 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_create_request.go @@ -78,21 +78,10 @@ func (o CloudWorkloadSecurityAgentRuleCreateRequest) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *CloudWorkloadSecurityAgentRuleCreateData `json:"data"` - }{} all := struct { - Data CloudWorkloadSecurityAgentRuleCreateData `json:"data"` + Data *CloudWorkloadSecurityAgentRuleCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *CloudWorkloadSecurityAgentRuleCreateRequest) UnmarshalJSON(bytes []byte } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go b/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go index e56daab4553..df7c08c952e 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_creator_attributes.go @@ -131,8 +131,7 @@ func (o *CloudWorkloadSecurityAgentRuleCreatorAttributes) UnmarshalJSON(bytes [] Handle *string `json:"handle,omitempty"` Name datadog.NullableString `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_data.go b/api/datadogV2/model_cloud_workload_security_agent_rule_data.go index 8796d32235e..1917ebb750c 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_data.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_data.go @@ -158,8 +158,7 @@ func (o *CloudWorkloadSecurityAgentRuleData) UnmarshalJSON(bytes []byte) (err er Id *string `json:"id,omitempty"` Type *CloudWorkloadSecurityAgentRuleType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_response.go b/api/datadogV2/model_cloud_workload_security_agent_rule_response.go index 4bdc46469b6..99c1d43e4dc 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_response.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_response.go @@ -86,8 +86,7 @@ func (o *CloudWorkloadSecurityAgentRuleResponse) UnmarshalJSON(bytes []byte) (er all := struct { Data *CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go b/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go index 7e852375900..49e9525fffd 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_update_attributes.go @@ -154,8 +154,7 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateAttributes) UnmarshalJSON(bytes []b Enabled *bool `json:"enabled,omitempty"` Expression *string `json:"expression,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go b/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go index 05127feafb1..0f3b03adeda 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_update_data.go @@ -107,26 +107,11 @@ func (o CloudWorkloadSecurityAgentRuleUpdateData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` Type *CloudWorkloadSecurityAgentRuleType `json:"type"` }{} - all := struct { - Attributes CloudWorkloadSecurityAgentRuleUpdateAttributes `json:"attributes"` - Type CloudWorkloadSecurityAgentRuleType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateData) UnmarshalJSON(bytes []byte) ( } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go b/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go index 7873f499210..95aa90595fc 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_update_request.go @@ -78,21 +78,10 @@ func (o CloudWorkloadSecurityAgentRuleUpdateRequest) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` - }{} all := struct { - Data CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` + Data *CloudWorkloadSecurityAgentRuleUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *CloudWorkloadSecurityAgentRuleUpdateRequest) UnmarshalJSON(bytes []byte } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go b/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go index 6cafbb8870c..5eeea8ae243 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_updater_attributes.go @@ -131,8 +131,7 @@ func (o *CloudWorkloadSecurityAgentRuleUpdaterAttributes) UnmarshalJSON(bytes [] Handle *string `json:"handle,omitempty"` Name datadog.NullableString `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go b/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go index 56487986c54..74da8f24ae6 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rules_list_response.go @@ -86,8 +86,7 @@ func (o *CloudWorkloadSecurityAgentRulesListResponse) UnmarshalJSON(bytes []byte all := struct { Data []CloudWorkloadSecurityAgentRuleData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloudflare_account_create_request.go b/api/datadogV2/model_cloudflare_account_create_request.go index ad84c15ce20..aa4631bfee4 100644 --- a/api/datadogV2/model_cloudflare_account_create_request.go +++ b/api/datadogV2/model_cloudflare_account_create_request.go @@ -78,21 +78,10 @@ func (o CloudflareAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *CloudflareAccountCreateRequestData `json:"data"` - }{} all := struct { - Data CloudflareAccountCreateRequestData `json:"data"` + Data *CloudflareAccountCreateRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *CloudflareAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *CloudflareAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloudflare_account_create_request_attributes.go b/api/datadogV2/model_cloudflare_account_create_request_attributes.go index e2850a711a1..3a0de002de9 100644 --- a/api/datadogV2/model_cloudflare_account_create_request_attributes.go +++ b/api/datadogV2/model_cloudflare_account_create_request_attributes.go @@ -138,27 +138,12 @@ func (o CloudflareAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ApiKey *string `json:"api_key"` - Name *string `json:"name"` - }{} all := struct { - ApiKey string `json:"api_key"` + ApiKey *string `json:"api_key"` Email *string `json:"email,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ApiKey == nil { - return fmt.Errorf("required field api_key missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,15 +151,21 @@ func (o *CloudflareAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.ApiKey == nil { + return fmt.Errorf("required field api_key missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"api_key", "email", "name"}) } else { return err } - o.ApiKey = all.ApiKey + o.ApiKey = *all.ApiKey o.Email = all.Email - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloudflare_account_create_request_data.go b/api/datadogV2/model_cloudflare_account_create_request_data.go index 8de774c2ab6..fb24e21c406 100644 --- a/api/datadogV2/model_cloudflare_account_create_request_data.go +++ b/api/datadogV2/model_cloudflare_account_create_request_data.go @@ -107,26 +107,11 @@ func (o CloudflareAccountCreateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *CloudflareAccountCreateRequestAttributes `json:"attributes"` Type *CloudflareAccountType `json:"type"` }{} - all := struct { - Attributes CloudflareAccountCreateRequestAttributes `json:"attributes"` - Type CloudflareAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *CloudflareAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *CloudflareAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err er } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloudflare_account_response.go b/api/datadogV2/model_cloudflare_account_response.go index aa731f4ce7c..ca5f04d7ba9 100644 --- a/api/datadogV2/model_cloudflare_account_response.go +++ b/api/datadogV2/model_cloudflare_account_response.go @@ -86,8 +86,7 @@ func (o *CloudflareAccountResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *CloudflareAccountResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloudflare_account_response_attributes.go b/api/datadogV2/model_cloudflare_account_response_attributes.go index c99e01b5e4a..652484fc17d 100644 --- a/api/datadogV2/model_cloudflare_account_response_attributes.go +++ b/api/datadogV2/model_cloudflare_account_response_attributes.go @@ -111,22 +111,11 @@ func (o CloudflareAccountResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { Email *string `json:"email,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *CloudflareAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"email", "name"}) @@ -141,7 +133,7 @@ func (o *CloudflareAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err e return err } o.Email = all.Email - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloudflare_account_response_data.go b/api/datadogV2/model_cloudflare_account_response_data.go index c6f90ce7dc1..247f5b3f14d 100644 --- a/api/datadogV2/model_cloudflare_account_response_data.go +++ b/api/datadogV2/model_cloudflare_account_response_data.go @@ -134,31 +134,12 @@ func (o CloudflareAccountResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *CloudflareAccountResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *CloudflareAccountType `json:"type"` }{} - all := struct { - Attributes CloudflareAccountResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type CloudflareAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *CloudflareAccountResponseData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *CloudflareAccountResponseData) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloudflare_account_update_request.go b/api/datadogV2/model_cloudflare_account_update_request.go index 7851bb811a7..9e3fda47ab1 100644 --- a/api/datadogV2/model_cloudflare_account_update_request.go +++ b/api/datadogV2/model_cloudflare_account_update_request.go @@ -78,21 +78,10 @@ func (o CloudflareAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *CloudflareAccountUpdateRequestData `json:"data"` - }{} all := struct { - Data CloudflareAccountUpdateRequestData `json:"data"` + Data *CloudflareAccountUpdateRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *CloudflareAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *CloudflareAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_cloudflare_account_update_request_attributes.go b/api/datadogV2/model_cloudflare_account_update_request_attributes.go index 79637055334..b654206aeec 100644 --- a/api/datadogV2/model_cloudflare_account_update_request_attributes.go +++ b/api/datadogV2/model_cloudflare_account_update_request_attributes.go @@ -111,22 +111,11 @@ func (o CloudflareAccountUpdateRequestAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *CloudflareAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ApiKey *string `json:"api_key"` - }{} all := struct { - ApiKey string `json:"api_key"` + ApiKey *string `json:"api_key"` Email *string `json:"email,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ApiKey == nil { - return fmt.Errorf("required field api_key missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *CloudflareAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.ApiKey == nil { + return fmt.Errorf("required field api_key missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"api_key", "email"}) } else { return err } - o.ApiKey = all.ApiKey + o.ApiKey = *all.ApiKey o.Email = all.Email if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_cloudflare_account_update_request_data.go b/api/datadogV2/model_cloudflare_account_update_request_data.go index fcec0784bf5..226121d9375 100644 --- a/api/datadogV2/model_cloudflare_account_update_request_data.go +++ b/api/datadogV2/model_cloudflare_account_update_request_data.go @@ -124,8 +124,7 @@ func (o *CloudflareAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err er Attributes *CloudflareAccountUpdateRequestAttributes `json:"attributes,omitempty"` Type *CloudflareAccountType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cloudflare_accounts_response.go b/api/datadogV2/model_cloudflare_accounts_response.go index 1060c760ae3..e75b5468338 100644 --- a/api/datadogV2/model_cloudflare_accounts_response.go +++ b/api/datadogV2/model_cloudflare_accounts_response.go @@ -86,8 +86,7 @@ func (o *CloudflareAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []CloudflareAccountResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_confluent_account_create_request.go b/api/datadogV2/model_confluent_account_create_request.go index 86cdc5fa670..64ce1887cf2 100644 --- a/api/datadogV2/model_confluent_account_create_request.go +++ b/api/datadogV2/model_confluent_account_create_request.go @@ -78,21 +78,10 @@ func (o ConfluentAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ConfluentAccountCreateRequestData `json:"data"` - }{} all := struct { - Data ConfluentAccountCreateRequestData `json:"data"` + Data *ConfluentAccountCreateRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ConfluentAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ConfluentAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_account_create_request_attributes.go b/api/datadogV2/model_confluent_account_create_request_attributes.go index 3a983a2b758..db123f894a2 100644 --- a/api/datadogV2/model_confluent_account_create_request_attributes.go +++ b/api/datadogV2/model_confluent_account_create_request_attributes.go @@ -171,28 +171,13 @@ func (o ConfluentAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ApiKey *string `json:"api_key"` - ApiSecret *string `json:"api_secret"` - }{} all := struct { - ApiKey string `json:"api_key"` - ApiSecret string `json:"api_secret"` + ApiKey *string `json:"api_key"` + ApiSecret *string `json:"api_secret"` Resources []ConfluentAccountResourceAttributes `json:"resources,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ApiKey == nil { - return fmt.Errorf("required field api_key missing") - } - if required.ApiSecret == nil { - return fmt.Errorf("required field api_secret missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,14 +185,20 @@ func (o *ConfluentAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.ApiKey == nil { + return fmt.Errorf("required field api_key missing") + } + if all.ApiSecret == nil { + return fmt.Errorf("required field api_secret missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"api_key", "api_secret", "resources", "tags"}) } else { return err } - o.ApiKey = all.ApiKey - o.ApiSecret = all.ApiSecret + o.ApiKey = *all.ApiKey + o.ApiSecret = *all.ApiSecret o.Resources = all.Resources o.Tags = all.Tags if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_confluent_account_create_request_data.go b/api/datadogV2/model_confluent_account_create_request_data.go index 0374bbf579f..1f5e6fec399 100644 --- a/api/datadogV2/model_confluent_account_create_request_data.go +++ b/api/datadogV2/model_confluent_account_create_request_data.go @@ -107,26 +107,11 @@ func (o ConfluentAccountCreateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ConfluentAccountCreateRequestAttributes `json:"attributes"` Type *ConfluentAccountType `json:"type"` }{} - all := struct { - Attributes ConfluentAccountCreateRequestAttributes `json:"attributes"` - Type ConfluentAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *ConfluentAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *ConfluentAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err err } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_account_resource_attributes.go b/api/datadogV2/model_confluent_account_resource_attributes.go index e531b696ce9..e052bd4cd0e 100644 --- a/api/datadogV2/model_confluent_account_resource_attributes.go +++ b/api/datadogV2/model_confluent_account_resource_attributes.go @@ -144,23 +144,12 @@ func (o ConfluentAccountResourceAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResourceAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ResourceType *string `json:"resource_type"` - }{} all := struct { Id *string `json:"id,omitempty"` - ResourceType string `json:"resource_type"` + ResourceType *string `json:"resource_type"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ResourceType == nil { - return fmt.Errorf("required field resource_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *ConfluentAccountResourceAttributes) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.ResourceType == nil { + return fmt.Errorf("required field resource_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "resource_type", "tags"}) @@ -175,7 +167,7 @@ func (o *ConfluentAccountResourceAttributes) UnmarshalJSON(bytes []byte) (err er return err } o.Id = all.Id - o.ResourceType = all.ResourceType + o.ResourceType = *all.ResourceType o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_confluent_account_response.go b/api/datadogV2/model_confluent_account_response.go index 53dc56d4689..39bdc6f4dd3 100644 --- a/api/datadogV2/model_confluent_account_response.go +++ b/api/datadogV2/model_confluent_account_response.go @@ -86,8 +86,7 @@ func (o *ConfluentAccountResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *ConfluentAccountResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_confluent_account_response_attributes.go b/api/datadogV2/model_confluent_account_response_attributes.go index 97d00cddf6a..0fd3b9dc5ae 100644 --- a/api/datadogV2/model_confluent_account_response_attributes.go +++ b/api/datadogV2/model_confluent_account_response_attributes.go @@ -144,23 +144,12 @@ func (o ConfluentAccountResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ApiKey *string `json:"api_key"` - }{} all := struct { - ApiKey string `json:"api_key"` + ApiKey *string `json:"api_key"` Resources []ConfluentResourceResponseAttributes `json:"resources,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ApiKey == nil { - return fmt.Errorf("required field api_key missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *ConfluentAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.ApiKey == nil { + return fmt.Errorf("required field api_key missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"api_key", "resources", "tags"}) } else { return err } - o.ApiKey = all.ApiKey + o.ApiKey = *all.ApiKey o.Resources = all.Resources o.Tags = all.Tags if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_confluent_account_response_data.go b/api/datadogV2/model_confluent_account_response_data.go index 05b33310880..c44b3957bd7 100644 --- a/api/datadogV2/model_confluent_account_response_data.go +++ b/api/datadogV2/model_confluent_account_response_data.go @@ -134,31 +134,12 @@ func (o ConfluentAccountResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ConfluentAccountResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *ConfluentAccountType `json:"type"` }{} - all := struct { - Attributes ConfluentAccountResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type ConfluentAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *ConfluentAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *ConfluentAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_account_update_request.go b/api/datadogV2/model_confluent_account_update_request.go index 4b39d2ff434..99367f41521 100644 --- a/api/datadogV2/model_confluent_account_update_request.go +++ b/api/datadogV2/model_confluent_account_update_request.go @@ -78,21 +78,10 @@ func (o ConfluentAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ConfluentAccountUpdateRequestData `json:"data"` - }{} all := struct { - Data ConfluentAccountUpdateRequestData `json:"data"` + Data *ConfluentAccountUpdateRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ConfluentAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ConfluentAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_account_update_request_attributes.go b/api/datadogV2/model_confluent_account_update_request_attributes.go index 195f8435315..5d8753a2241 100644 --- a/api/datadogV2/model_confluent_account_update_request_attributes.go +++ b/api/datadogV2/model_confluent_account_update_request_attributes.go @@ -138,27 +138,12 @@ func (o ConfluentAccountUpdateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ApiKey *string `json:"api_key"` - ApiSecret *string `json:"api_secret"` - }{} all := struct { - ApiKey string `json:"api_key"` - ApiSecret string `json:"api_secret"` + ApiKey *string `json:"api_key"` + ApiSecret *string `json:"api_secret"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ApiKey == nil { - return fmt.Errorf("required field api_key missing") - } - if required.ApiSecret == nil { - return fmt.Errorf("required field api_secret missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,14 +151,20 @@ func (o *ConfluentAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.ApiKey == nil { + return fmt.Errorf("required field api_key missing") + } + if all.ApiSecret == nil { + return fmt.Errorf("required field api_secret missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"api_key", "api_secret", "tags"}) } else { return err } - o.ApiKey = all.ApiKey - o.ApiSecret = all.ApiSecret + o.ApiKey = *all.ApiKey + o.ApiSecret = *all.ApiSecret o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_confluent_account_update_request_data.go b/api/datadogV2/model_confluent_account_update_request_data.go index 95618c5ec39..72cc42c3c3c 100644 --- a/api/datadogV2/model_confluent_account_update_request_data.go +++ b/api/datadogV2/model_confluent_account_update_request_data.go @@ -107,26 +107,11 @@ func (o ConfluentAccountUpdateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ConfluentAccountUpdateRequestAttributes `json:"attributes"` Type *ConfluentAccountType `json:"type"` }{} - all := struct { - Attributes ConfluentAccountUpdateRequestAttributes `json:"attributes"` - Type ConfluentAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *ConfluentAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *ConfluentAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err err } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_accounts_response.go b/api/datadogV2/model_confluent_accounts_response.go index 85bb4f847cd..b371a800244 100644 --- a/api/datadogV2/model_confluent_accounts_response.go +++ b/api/datadogV2/model_confluent_accounts_response.go @@ -86,8 +86,7 @@ func (o *ConfluentAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []ConfluentAccountResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_confluent_resource_request.go b/api/datadogV2/model_confluent_resource_request.go index c38b3aaee69..e118a15ee06 100644 --- a/api/datadogV2/model_confluent_resource_request.go +++ b/api/datadogV2/model_confluent_resource_request.go @@ -78,21 +78,10 @@ func (o ConfluentResourceRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ConfluentResourceRequestData `json:"data"` - }{} all := struct { - Data ConfluentResourceRequestData `json:"data"` + Data *ConfluentResourceRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ConfluentResourceRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ConfluentResourceRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_resource_request_attributes.go b/api/datadogV2/model_confluent_resource_request_attributes.go index 7294b18b706..1ac8087496e 100644 --- a/api/datadogV2/model_confluent_resource_request_attributes.go +++ b/api/datadogV2/model_confluent_resource_request_attributes.go @@ -111,22 +111,11 @@ func (o ConfluentResourceRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ResourceType *string `json:"resource_type"` - }{} all := struct { - ResourceType string `json:"resource_type"` + ResourceType *string `json:"resource_type"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ResourceType == nil { - return fmt.Errorf("required field resource_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *ConfluentResourceRequestAttributes) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.ResourceType == nil { + return fmt.Errorf("required field resource_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"resource_type", "tags"}) } else { return err } - o.ResourceType = all.ResourceType + o.ResourceType = *all.ResourceType o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_confluent_resource_request_data.go b/api/datadogV2/model_confluent_resource_request_data.go index 24bd4714a95..40786dc5da5 100644 --- a/api/datadogV2/model_confluent_resource_request_data.go +++ b/api/datadogV2/model_confluent_resource_request_data.go @@ -134,31 +134,12 @@ func (o ConfluentResourceRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceRequestData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ConfluentResourceRequestAttributes `json:"attributes"` Id *string `json:"id"` Type *ConfluentResourceType `json:"type"` }{} - all := struct { - Attributes ConfluentResourceRequestAttributes `json:"attributes"` - Id string `json:"id"` - Type ConfluentResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *ConfluentResourceRequestData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *ConfluentResourceRequestData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_resource_response.go b/api/datadogV2/model_confluent_resource_response.go index 384251e1243..3ffb0a709de 100644 --- a/api/datadogV2/model_confluent_resource_response.go +++ b/api/datadogV2/model_confluent_resource_response.go @@ -86,8 +86,7 @@ func (o *ConfluentResourceResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *ConfluentResourceResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_confluent_resource_response_attributes.go b/api/datadogV2/model_confluent_resource_response_attributes.go index adf3ad9d6b0..78725b991db 100644 --- a/api/datadogV2/model_confluent_resource_response_attributes.go +++ b/api/datadogV2/model_confluent_resource_response_attributes.go @@ -111,22 +111,11 @@ func (o ConfluentResourceResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ResourceType *string `json:"resource_type"` - }{} all := struct { - ResourceType string `json:"resource_type"` + ResourceType *string `json:"resource_type"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ResourceType == nil { - return fmt.Errorf("required field resource_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *ConfluentResourceResponseAttributes) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.ResourceType == nil { + return fmt.Errorf("required field resource_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"resource_type", "tags"}) } else { return err } - o.ResourceType = all.ResourceType + o.ResourceType = *all.ResourceType o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_confluent_resource_response_data.go b/api/datadogV2/model_confluent_resource_response_data.go index 5c4e50fad96..1b36b5656a8 100644 --- a/api/datadogV2/model_confluent_resource_response_data.go +++ b/api/datadogV2/model_confluent_resource_response_data.go @@ -134,31 +134,12 @@ func (o ConfluentResourceResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ConfluentResourceResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ConfluentResourceResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *ConfluentResourceType `json:"type"` }{} - all := struct { - Attributes ConfluentResourceResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type ConfluentResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *ConfluentResourceResponseData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *ConfluentResourceResponseData) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_confluent_resources_response.go b/api/datadogV2/model_confluent_resources_response.go index a0f9f337458..e7174b93488 100644 --- a/api/datadogV2/model_confluent_resources_response.go +++ b/api/datadogV2/model_confluent_resources_response.go @@ -86,8 +86,7 @@ func (o *ConfluentResourcesResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []ConfluentResourceResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cost_by_org.go b/api/datadogV2/model_cost_by_org.go index 4dd4758ba49..4f0ade4ac3a 100644 --- a/api/datadogV2/model_cost_by_org.go +++ b/api/datadogV2/model_cost_by_org.go @@ -158,8 +158,7 @@ func (o *CostByOrg) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *CostByOrgType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cost_by_org_attributes.go b/api/datadogV2/model_cost_by_org_attributes.go index 62b58387fc5..02dcabc1f96 100644 --- a/api/datadogV2/model_cost_by_org_attributes.go +++ b/api/datadogV2/model_cost_by_org_attributes.go @@ -261,8 +261,7 @@ func (o *CostByOrgAttributes) UnmarshalJSON(bytes []byte) (err error) { Region *string `json:"region,omitempty"` TotalCost *float64 `json:"total_cost,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_cost_by_org_response.go b/api/datadogV2/model_cost_by_org_response.go index dd1c253ea88..60bbcb1ceae 100644 --- a/api/datadogV2/model_cost_by_org_response.go +++ b/api/datadogV2/model_cost_by_org_response.go @@ -86,8 +86,7 @@ func (o *CostByOrgResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []CostByOrg `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_creator.go b/api/datadogV2/model_creator.go index a81baaa1d26..c3e0d87b156 100644 --- a/api/datadogV2/model_creator.go +++ b/api/datadogV2/model_creator.go @@ -165,8 +165,7 @@ func (o *Creator) UnmarshalJSON(bytes []byte) (err error) { Handle *string `json:"handle,omitempty"` Name datadog.NullableString `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_dashboard_list_add_items_request.go b/api/datadogV2/model_dashboard_list_add_items_request.go index cd6e88a087c..a04beea7b92 100644 --- a/api/datadogV2/model_dashboard_list_add_items_request.go +++ b/api/datadogV2/model_dashboard_list_add_items_request.go @@ -86,8 +86,7 @@ func (o *DashboardListAddItemsRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_dashboard_list_add_items_response.go b/api/datadogV2/model_dashboard_list_add_items_response.go index bbdcb459d1c..409f13eefaa 100644 --- a/api/datadogV2/model_dashboard_list_add_items_response.go +++ b/api/datadogV2/model_dashboard_list_add_items_response.go @@ -86,8 +86,7 @@ func (o *DashboardListAddItemsResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { AddedDashboardsToList []DashboardListItemResponse `json:"added_dashboards_to_list,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_dashboard_list_delete_items_request.go b/api/datadogV2/model_dashboard_list_delete_items_request.go index f749f8e357a..35a77f39d26 100644 --- a/api/datadogV2/model_dashboard_list_delete_items_request.go +++ b/api/datadogV2/model_dashboard_list_delete_items_request.go @@ -86,8 +86,7 @@ func (o *DashboardListDeleteItemsRequest) UnmarshalJSON(bytes []byte) (err error all := struct { Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_dashboard_list_delete_items_response.go b/api/datadogV2/model_dashboard_list_delete_items_response.go index ec2dd16f97a..180310329b5 100644 --- a/api/datadogV2/model_dashboard_list_delete_items_response.go +++ b/api/datadogV2/model_dashboard_list_delete_items_response.go @@ -86,8 +86,7 @@ func (o *DashboardListDeleteItemsResponse) UnmarshalJSON(bytes []byte) (err erro all := struct { DeletedDashboardsFromList []DashboardListItemResponse `json:"deleted_dashboards_from_list,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_dashboard_list_item.go b/api/datadogV2/model_dashboard_list_item.go index 8d25943992b..754fc8dddb2 100644 --- a/api/datadogV2/model_dashboard_list_item.go +++ b/api/datadogV2/model_dashboard_list_item.go @@ -455,36 +455,21 @@ func (o DashboardListItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *DashboardType `json:"type"` - }{} all := struct { Author *Creator `json:"author,omitempty"` Created *time.Time `json:"created,omitempty"` Icon datadog.NullableString `json:"icon,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` IsFavorite *bool `json:"is_favorite,omitempty"` IsReadOnly *bool `json:"is_read_only,omitempty"` IsShared *bool `json:"is_shared,omitempty"` Modified *time.Time `json:"modified,omitempty"` Popularity *int32 `json:"popularity,omitempty"` Title *string `json:"title,omitempty"` - Type DashboardType `json:"type"` + Type *DashboardType `json:"type"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -492,6 +477,12 @@ func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"author", "created", "icon", "id", "is_favorite", "is_read_only", "is_shared", "modified", "popularity", "title", "type", "url"}) @@ -516,14 +507,14 @@ func (o *DashboardListItem) UnmarshalJSON(bytes []byte) (err error) { o.Author = all.Author o.Created = all.Created o.Icon = all.Icon - o.Id = all.Id + o.Id = *all.Id o.IsFavorite = all.IsFavorite o.IsReadOnly = all.IsReadOnly o.IsShared = all.IsShared o.Modified = all.Modified o.Popularity = all.Popularity o.Title = all.Title - o.Type = all.Type + o.Type = *all.Type o.Url = all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_dashboard_list_item_request.go b/api/datadogV2/model_dashboard_list_item_request.go index 01e3c0f59bd..46ddbc43dc7 100644 --- a/api/datadogV2/model_dashboard_list_item_request.go +++ b/api/datadogV2/model_dashboard_list_item_request.go @@ -105,26 +105,11 @@ func (o DashboardListItemRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *DashboardType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type DashboardType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -146,8 +137,8 @@ func (o *DashboardListItemRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_dashboard_list_item_response.go b/api/datadogV2/model_dashboard_list_item_response.go index c0d37bf5871..a27ba6192f7 100644 --- a/api/datadogV2/model_dashboard_list_item_response.go +++ b/api/datadogV2/model_dashboard_list_item_response.go @@ -105,26 +105,11 @@ func (o DashboardListItemResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *DashboardType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type DashboardType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -146,8 +137,8 @@ func (o *DashboardListItemResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_dashboard_list_items.go b/api/datadogV2/model_dashboard_list_items.go index feea7ab2c61..6734698968e 100644 --- a/api/datadogV2/model_dashboard_list_items.go +++ b/api/datadogV2/model_dashboard_list_items.go @@ -111,22 +111,11 @@ func (o DashboardListItems) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *DashboardListItems) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Dashboards *[]DashboardListItem `json:"dashboards"` - }{} all := struct { - Dashboards []DashboardListItem `json:"dashboards"` - Total *int64 `json:"total,omitempty"` + Dashboards *[]DashboardListItem `json:"dashboards"` + Total *int64 `json:"total,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Dashboards == nil { - return fmt.Errorf("required field dashboards missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *DashboardListItems) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Dashboards == nil { + return fmt.Errorf("required field dashboards missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"dashboards", "total"}) } else { return err } - o.Dashboards = all.Dashboards + o.Dashboards = *all.Dashboards o.Total = all.Total if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_dashboard_list_update_items_request.go b/api/datadogV2/model_dashboard_list_update_items_request.go index 0b0c290ca19..919674bff95 100644 --- a/api/datadogV2/model_dashboard_list_update_items_request.go +++ b/api/datadogV2/model_dashboard_list_update_items_request.go @@ -86,8 +86,7 @@ func (o *DashboardListUpdateItemsRequest) UnmarshalJSON(bytes []byte) (err error all := struct { Dashboards []DashboardListItemRequest `json:"dashboards,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_dashboard_list_update_items_response.go b/api/datadogV2/model_dashboard_list_update_items_response.go index 33e5be8646e..870c2806617 100644 --- a/api/datadogV2/model_dashboard_list_update_items_response.go +++ b/api/datadogV2/model_dashboard_list_update_items_response.go @@ -86,8 +86,7 @@ func (o *DashboardListUpdateItemsResponse) UnmarshalJSON(bytes []byte) (err erro all := struct { Dashboards []DashboardListItemResponse `json:"dashboards,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_data_scalar_column.go b/api/datadogV2/model_data_scalar_column.go index 3aa98b0631e..4b6fea30364 100644 --- a/api/datadogV2/model_data_scalar_column.go +++ b/api/datadogV2/model_data_scalar_column.go @@ -188,8 +188,7 @@ func (o *DataScalarColumn) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` Values []float64 `json:"values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_detailed_finding.go b/api/datadogV2/model_detailed_finding.go index f4a293d234a..fda859a8d2f 100644 --- a/api/datadogV2/model_detailed_finding.go +++ b/api/datadogV2/model_detailed_finding.go @@ -158,8 +158,7 @@ func (o *DetailedFinding) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *DetailedFindingType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_detailed_finding_attributes.go b/api/datadogV2/model_detailed_finding_attributes.go index 3a6b094228f..d3fd4777839 100644 --- a/api/datadogV2/model_detailed_finding_attributes.go +++ b/api/datadogV2/model_detailed_finding_attributes.go @@ -426,8 +426,7 @@ func (o *DetailedFindingAttributes) UnmarshalJSON(bytes []byte) (err error) { Status *FindingStatus `json:"status,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_event.go b/api/datadogV2/model_event.go index 788e76b63b7..43f1a612974 100644 --- a/api/datadogV2/model_event.go +++ b/api/datadogV2/model_event.go @@ -188,8 +188,7 @@ func (o *Event) UnmarshalJSON(bytes []byte) (err error) { SourceId *int64 `json:"source_id,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_event_attributes.go b/api/datadogV2/model_event_attributes.go index 74a4fc46519..4fd7b7abfb0 100644 --- a/api/datadogV2/model_event_attributes.go +++ b/api/datadogV2/model_event_attributes.go @@ -748,8 +748,7 @@ func (o *EventAttributes) UnmarshalJSON(bytes []byte) (err error) { Timestamp *int64 `json:"timestamp,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_event_response.go b/api/datadogV2/model_event_response.go index 5c96be321be..9b60003b51c 100644 --- a/api/datadogV2/model_event_response.go +++ b/api/datadogV2/model_event_response.go @@ -158,8 +158,7 @@ func (o *EventResponse) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *EventType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_event_response_attributes.go b/api/datadogV2/model_event_response_attributes.go index 5ca04569f2f..b7c4b021d8b 100644 --- a/api/datadogV2/model_event_response_attributes.go +++ b/api/datadogV2/model_event_response_attributes.go @@ -159,8 +159,7 @@ func (o *EventResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_compute.go b/api/datadogV2/model_events_compute.go index 9040b70d7ad..039a5dcae95 100644 --- a/api/datadogV2/model_events_compute.go +++ b/api/datadogV2/model_events_compute.go @@ -146,23 +146,12 @@ func (o EventsCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *EventsAggregation `json:"aggregation"` - }{} all := struct { - Aggregation EventsAggregation `json:"aggregation"` - Interval *int64 `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` + Aggregation *EventsAggregation `json:"aggregation"` + Interval *int64 `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *EventsCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "interval", "metric"}) @@ -184,7 +176,7 @@ func (o *EventsCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_events_group_by.go b/api/datadogV2/model_events_group_by.go index ece6f302fe6..2789eb637ed 100644 --- a/api/datadogV2/model_events_group_by.go +++ b/api/datadogV2/model_events_group_by.go @@ -144,23 +144,12 @@ func (o EventsGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Limit *int32 `json:"limit,omitempty"` Sort *EventsGroupBySort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *EventsGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "limit", "sort"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet o.Limit = all.Limit if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_events_group_by_sort.go b/api/datadogV2/model_events_group_by_sort.go index 575aeee8b3c..0a83ee4e398 100644 --- a/api/datadogV2/model_events_group_by_sort.go +++ b/api/datadogV2/model_events_group_by_sort.go @@ -183,24 +183,13 @@ func (o EventsGroupBySort) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsGroupBySort) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *EventsAggregation `json:"aggregation"` - }{} all := struct { - Aggregation EventsAggregation `json:"aggregation"` - Metric *string `json:"metric,omitempty"` - Order *QuerySortOrder `json:"order,omitempty"` - Type *EventsSortType `json:"type,omitempty"` + Aggregation *EventsAggregation `json:"aggregation"` + Metric *string `json:"metric,omitempty"` + Order *QuerySortOrder `json:"order,omitempty"` + Type *EventsSortType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -208,6 +197,9 @@ func (o *EventsGroupBySort) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "metric", "order", "type"}) @@ -238,7 +230,7 @@ func (o *EventsGroupBySort) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Metric = all.Metric o.Order = all.Order o.Type = all.Type diff --git a/api/datadogV2/model_events_list_request.go b/api/datadogV2/model_events_list_request.go index 4815164ae50..8f8543326ea 100644 --- a/api/datadogV2/model_events_list_request.go +++ b/api/datadogV2/model_events_list_request.go @@ -189,8 +189,7 @@ func (o *EventsListRequest) UnmarshalJSON(bytes []byte) (err error) { Page *EventsRequestPage `json:"page,omitempty"` Sort *EventsSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_list_response.go b/api/datadogV2/model_events_list_response.go index 114a732d7f4..ae030e3dab0 100644 --- a/api/datadogV2/model_events_list_response.go +++ b/api/datadogV2/model_events_list_response.go @@ -154,8 +154,7 @@ func (o *EventsListResponse) UnmarshalJSON(bytes []byte) (err error) { Links *EventsListResponseLinks `json:"links,omitempty"` Meta *EventsResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_list_response_links.go b/api/datadogV2/model_events_list_response_links.go index 676bdde8c5b..de52373ee60 100644 --- a/api/datadogV2/model_events_list_response_links.go +++ b/api/datadogV2/model_events_list_response_links.go @@ -87,8 +87,7 @@ func (o *EventsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { all := struct { Next *string `json:"next,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_query_filter.go b/api/datadogV2/model_events_query_filter.go index edc72b392e5..c3300b1bac5 100644 --- a/api/datadogV2/model_events_query_filter.go +++ b/api/datadogV2/model_events_query_filter.go @@ -166,8 +166,7 @@ func (o *EventsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_query_options.go b/api/datadogV2/model_events_query_options.go index 9e64c21a16a..449f3a45768 100644 --- a/api/datadogV2/model_events_query_options.go +++ b/api/datadogV2/model_events_query_options.go @@ -125,8 +125,7 @@ func (o *EventsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { TimeOffset *int64 `json:"timeOffset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_request_page.go b/api/datadogV2/model_events_request_page.go index 5789e3f0214..81f635682e8 100644 --- a/api/datadogV2/model_events_request_page.go +++ b/api/datadogV2/model_events_request_page.go @@ -124,8 +124,7 @@ func (o *EventsRequestPage) UnmarshalJSON(bytes []byte) (err error) { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_response_metadata.go b/api/datadogV2/model_events_response_metadata.go index bc35b2088f2..3051c710585 100644 --- a/api/datadogV2/model_events_response_metadata.go +++ b/api/datadogV2/model_events_response_metadata.go @@ -189,8 +189,7 @@ func (o *EventsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { RequestId *string `json:"request_id,omitempty"` Warnings []EventsWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_response_metadata_page.go b/api/datadogV2/model_events_response_metadata_page.go index 078c1dcdeb4..d6afeeb7256 100644 --- a/api/datadogV2/model_events_response_metadata_page.go +++ b/api/datadogV2/model_events_response_metadata_page.go @@ -87,8 +87,7 @@ func (o *EventsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { all := struct { After *string `json:"after,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_scalar_query.go b/api/datadogV2/model_events_scalar_query.go index 5c829539fc0..24c5e0692d8 100644 --- a/api/datadogV2/model_events_scalar_query.go +++ b/api/datadogV2/model_events_scalar_query.go @@ -239,30 +239,15 @@ func (o EventsScalarQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Compute *EventsCompute `json:"compute"` DataSource *EventsDataSource `json:"data_source"` + GroupBy []EventsGroupBy `json:"group_by,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Name *string `json:"name,omitempty"` + Search *EventsSearch `json:"search,omitempty"` }{} - all := struct { - Compute EventsCompute `json:"compute"` - DataSource EventsDataSource `json:"data_source"` - GroupBy []EventsGroupBy `json:"group_by,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Name *string `json:"name,omitempty"` - Search *EventsSearch `json:"search,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("required field compute missing") - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -270,6 +255,12 @@ func (o *EventsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Compute == nil { + return fmt.Errorf("required field compute missing") + } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "data_source", "group_by", "indexes", "name", "search"}) @@ -291,8 +282,8 @@ func (o *EventsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Compute = all.Compute - o.DataSource = all.DataSource + o.Compute = *all.Compute + o.DataSource = *all.DataSource o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.Name = all.Name diff --git a/api/datadogV2/model_events_search.go b/api/datadogV2/model_events_search.go index b4a4b0177d4..500c3e35e5a 100644 --- a/api/datadogV2/model_events_search.go +++ b/api/datadogV2/model_events_search.go @@ -86,8 +86,7 @@ func (o *EventsSearch) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_events_timeseries_query.go b/api/datadogV2/model_events_timeseries_query.go index 51d784e0dee..2fd948a8c6e 100644 --- a/api/datadogV2/model_events_timeseries_query.go +++ b/api/datadogV2/model_events_timeseries_query.go @@ -239,30 +239,15 @@ func (o EventsTimeseriesQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Compute *EventsCompute `json:"compute"` DataSource *EventsDataSource `json:"data_source"` + GroupBy []EventsGroupBy `json:"group_by,omitempty"` + Indexes []string `json:"indexes,omitempty"` + Name *string `json:"name,omitempty"` + Search *EventsSearch `json:"search,omitempty"` }{} - all := struct { - Compute EventsCompute `json:"compute"` - DataSource EventsDataSource `json:"data_source"` - GroupBy []EventsGroupBy `json:"group_by,omitempty"` - Indexes []string `json:"indexes,omitempty"` - Name *string `json:"name,omitempty"` - Search *EventsSearch `json:"search,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("required field compute missing") - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -270,6 +255,12 @@ func (o *EventsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Compute == nil { + return fmt.Errorf("required field compute missing") + } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "data_source", "group_by", "indexes", "name", "search"}) @@ -291,8 +282,8 @@ func (o *EventsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Compute = all.Compute - o.DataSource = all.DataSource + o.Compute = *all.Compute + o.DataSource = *all.DataSource o.GroupBy = all.GroupBy o.Indexes = all.Indexes o.Name = all.Name diff --git a/api/datadogV2/model_events_warning.go b/api/datadogV2/model_events_warning.go index 518161c29d1..ef4da426fe9 100644 --- a/api/datadogV2/model_events_warning.go +++ b/api/datadogV2/model_events_warning.go @@ -154,8 +154,7 @@ func (o *EventsWarning) UnmarshalJSON(bytes []byte) (err error) { Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_accoun_response_attributes.go b/api/datadogV2/model_fastly_accoun_response_attributes.go index d6f1cfffe5a..b72007404f5 100644 --- a/api/datadogV2/model_fastly_accoun_response_attributes.go +++ b/api/datadogV2/model_fastly_accoun_response_attributes.go @@ -111,22 +111,11 @@ func (o FastlyAccounResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccounResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` Services []FastlyService `json:"services,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *FastlyAccounResponseAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "services"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name o.Services = all.Services if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_fastly_account_create_request.go b/api/datadogV2/model_fastly_account_create_request.go index 2bec46813ac..0e64efc22e9 100644 --- a/api/datadogV2/model_fastly_account_create_request.go +++ b/api/datadogV2/model_fastly_account_create_request.go @@ -78,21 +78,10 @@ func (o FastlyAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *FastlyAccountCreateRequestData `json:"data"` - }{} all := struct { - Data FastlyAccountCreateRequestData `json:"data"` + Data *FastlyAccountCreateRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *FastlyAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *FastlyAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_fastly_account_create_request_attributes.go b/api/datadogV2/model_fastly_account_create_request_attributes.go index a77a86f75dd..7170467274c 100644 --- a/api/datadogV2/model_fastly_account_create_request_attributes.go +++ b/api/datadogV2/model_fastly_account_create_request_attributes.go @@ -138,27 +138,12 @@ func (o FastlyAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ApiKey *string `json:"api_key"` - Name *string `json:"name"` - }{} all := struct { - ApiKey string `json:"api_key"` - Name string `json:"name"` + ApiKey *string `json:"api_key"` + Name *string `json:"name"` Services []FastlyService `json:"services,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ApiKey == nil { - return fmt.Errorf("required field api_key missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,14 +151,20 @@ func (o *FastlyAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.ApiKey == nil { + return fmt.Errorf("required field api_key missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"api_key", "name", "services"}) } else { return err } - o.ApiKey = all.ApiKey - o.Name = all.Name + o.ApiKey = *all.ApiKey + o.Name = *all.Name o.Services = all.Services if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_fastly_account_create_request_data.go b/api/datadogV2/model_fastly_account_create_request_data.go index 2573dca8f67..6b56c068ced 100644 --- a/api/datadogV2/model_fastly_account_create_request_data.go +++ b/api/datadogV2/model_fastly_account_create_request_data.go @@ -107,26 +107,11 @@ func (o FastlyAccountCreateRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *FastlyAccountCreateRequestAttributes `json:"attributes"` Type *FastlyAccountType `json:"type"` }{} - all := struct { - Attributes FastlyAccountCreateRequestAttributes `json:"attributes"` - Type FastlyAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *FastlyAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *FastlyAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_fastly_account_response.go b/api/datadogV2/model_fastly_account_response.go index 6c1e855cd7a..3d889faaddd 100644 --- a/api/datadogV2/model_fastly_account_response.go +++ b/api/datadogV2/model_fastly_account_response.go @@ -86,8 +86,7 @@ func (o *FastlyAccountResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *FastlyAccountResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_account_response_data.go b/api/datadogV2/model_fastly_account_response_data.go index e452037127d..9a46d34c4d8 100644 --- a/api/datadogV2/model_fastly_account_response_data.go +++ b/api/datadogV2/model_fastly_account_response_data.go @@ -134,31 +134,12 @@ func (o FastlyAccountResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *FastlyAccounResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *FastlyAccountType `json:"type"` }{} - all := struct { - Attributes FastlyAccounResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type FastlyAccountType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *FastlyAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *FastlyAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_fastly_account_update_request.go b/api/datadogV2/model_fastly_account_update_request.go index 1e6509933ff..8dcb0054d62 100644 --- a/api/datadogV2/model_fastly_account_update_request.go +++ b/api/datadogV2/model_fastly_account_update_request.go @@ -78,21 +78,10 @@ func (o FastlyAccountUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *FastlyAccountUpdateRequestData `json:"data"` - }{} all := struct { - Data FastlyAccountUpdateRequestData `json:"data"` + Data *FastlyAccountUpdateRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *FastlyAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *FastlyAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_fastly_account_update_request_attributes.go b/api/datadogV2/model_fastly_account_update_request_attributes.go index 21ab20a5883..28237647105 100644 --- a/api/datadogV2/model_fastly_account_update_request_attributes.go +++ b/api/datadogV2/model_fastly_account_update_request_attributes.go @@ -86,8 +86,7 @@ func (o *FastlyAccountUpdateRequestAttributes) UnmarshalJSON(bytes []byte) (err all := struct { ApiKey *string `json:"api_key,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_account_update_request_data.go b/api/datadogV2/model_fastly_account_update_request_data.go index d197ed54c2c..de429cf6f0f 100644 --- a/api/datadogV2/model_fastly_account_update_request_data.go +++ b/api/datadogV2/model_fastly_account_update_request_data.go @@ -124,8 +124,7 @@ func (o *FastlyAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) Attributes *FastlyAccountUpdateRequestAttributes `json:"attributes,omitempty"` Type *FastlyAccountType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_accounts_response.go b/api/datadogV2/model_fastly_accounts_response.go index b95f2d685b6..3489810c0dc 100644 --- a/api/datadogV2/model_fastly_accounts_response.go +++ b/api/datadogV2/model_fastly_accounts_response.go @@ -86,8 +86,7 @@ func (o *FastlyAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []FastlyAccountResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_service.go b/api/datadogV2/model_fastly_service.go index 05764d4e34c..c034d8529b6 100644 --- a/api/datadogV2/model_fastly_service.go +++ b/api/datadogV2/model_fastly_service.go @@ -111,22 +111,11 @@ func (o FastlyService) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyService) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - }{} all := struct { - Id string `json:"id"` + Id *string `json:"id"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *FastlyService) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "tags"}) } else { return err } - o.Id = all.Id + o.Id = *all.Id o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_fastly_service_attributes.go b/api/datadogV2/model_fastly_service_attributes.go index 308a1476dfb..81467a9daf8 100644 --- a/api/datadogV2/model_fastly_service_attributes.go +++ b/api/datadogV2/model_fastly_service_attributes.go @@ -86,8 +86,7 @@ func (o *FastlyServiceAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_service_data.go b/api/datadogV2/model_fastly_service_data.go index 1fae782027c..b3ff9593b09 100644 --- a/api/datadogV2/model_fastly_service_data.go +++ b/api/datadogV2/model_fastly_service_data.go @@ -140,27 +140,12 @@ func (o FastlyServiceData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServiceData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *FastlyServiceType `json:"type"` - }{} all := struct { Attributes *FastlyServiceAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type FastlyServiceType `json:"type"` + Id *string `json:"id"` + Type *FastlyServiceType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *FastlyServiceData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *FastlyServiceData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_fastly_service_request.go b/api/datadogV2/model_fastly_service_request.go index 764cfafbba1..7febe13e64d 100644 --- a/api/datadogV2/model_fastly_service_request.go +++ b/api/datadogV2/model_fastly_service_request.go @@ -78,21 +78,10 @@ func (o FastlyServiceRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *FastlyServiceRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *FastlyServiceData `json:"data"` - }{} all := struct { - Data FastlyServiceData `json:"data"` + Data *FastlyServiceData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *FastlyServiceRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *FastlyServiceRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_fastly_service_response.go b/api/datadogV2/model_fastly_service_response.go index 47ec4b179be..5b5d0d27ea7 100644 --- a/api/datadogV2/model_fastly_service_response.go +++ b/api/datadogV2/model_fastly_service_response.go @@ -86,8 +86,7 @@ func (o *FastlyServiceResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *FastlyServiceData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_fastly_services_response.go b/api/datadogV2/model_fastly_services_response.go index 2a0ee1a22e2..6b2456a458c 100644 --- a/api/datadogV2/model_fastly_services_response.go +++ b/api/datadogV2/model_fastly_services_response.go @@ -86,8 +86,7 @@ func (o *FastlyServicesResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []FastlyServiceResponse `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_finding.go b/api/datadogV2/model_finding.go index 22920581d81..347cb528122 100644 --- a/api/datadogV2/model_finding.go +++ b/api/datadogV2/model_finding.go @@ -158,8 +158,7 @@ func (o *Finding) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *FindingType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_finding_attributes.go b/api/datadogV2/model_finding_attributes.go index 482964f319d..6fbea4f4eba 100644 --- a/api/datadogV2/model_finding_attributes.go +++ b/api/datadogV2/model_finding_attributes.go @@ -358,8 +358,7 @@ func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) { Status *FindingStatus `json:"status,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_finding_mute.go b/api/datadogV2/model_finding_mute.go index 345115dc8f8..f47921545e0 100644 --- a/api/datadogV2/model_finding_mute.go +++ b/api/datadogV2/model_finding_mute.go @@ -249,8 +249,7 @@ func (o *FindingMute) UnmarshalJSON(bytes []byte) (err error) { StartDate *int64 `json:"start_date,omitempty"` Uuid *string `json:"uuid,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_finding_rule.go b/api/datadogV2/model_finding_rule.go index dd147d4acf7..3410ced4c8f 100644 --- a/api/datadogV2/model_finding_rule.go +++ b/api/datadogV2/model_finding_rule.go @@ -113,8 +113,7 @@ func (o *FindingRule) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_formula_limit.go b/api/datadogV2/model_formula_limit.go index 529b68eee75..b7dd9bccd4f 100644 --- a/api/datadogV2/model_formula_limit.go +++ b/api/datadogV2/model_formula_limit.go @@ -124,8 +124,7 @@ func (o *FormulaLimit) UnmarshalJSON(bytes []byte) (err error) { Count *int32 `json:"count,omitempty"` Order *QuerySortOrder `json:"order,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_full_api_key.go b/api/datadogV2/model_full_api_key.go index eb237d5eda8..85d1c72ef51 100644 --- a/api/datadogV2/model_full_api_key.go +++ b/api/datadogV2/model_full_api_key.go @@ -192,8 +192,7 @@ func (o *FullAPIKey) UnmarshalJSON(bytes []byte) (err error) { Relationships *APIKeyRelationships `json:"relationships,omitempty"` Type *APIKeysType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_full_api_key_attributes.go b/api/datadogV2/model_full_api_key_attributes.go index 9463572bd31..7ecb7f9e3fa 100644 --- a/api/datadogV2/model_full_api_key_attributes.go +++ b/api/datadogV2/model_full_api_key_attributes.go @@ -222,8 +222,7 @@ func (o *FullAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { ModifiedAt *string `json:"modified_at,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_full_application_key.go b/api/datadogV2/model_full_application_key.go index c9cd9655c23..6d007082d57 100644 --- a/api/datadogV2/model_full_application_key.go +++ b/api/datadogV2/model_full_application_key.go @@ -192,8 +192,7 @@ func (o *FullApplicationKey) UnmarshalJSON(bytes []byte) (err error) { Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` Type *ApplicationKeysType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_full_application_key_attributes.go b/api/datadogV2/model_full_application_key_attributes.go index aec3c790abd..2238a80a95f 100644 --- a/api/datadogV2/model_full_application_key_attributes.go +++ b/api/datadogV2/model_full_application_key_attributes.go @@ -233,8 +233,7 @@ func (o *FullApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcp_service_account_meta.go b/api/datadogV2/model_gcp_service_account_meta.go index 4ef090e9720..353163179e1 100644 --- a/api/datadogV2/model_gcp_service_account_meta.go +++ b/api/datadogV2/model_gcp_service_account_meta.go @@ -86,8 +86,7 @@ func (o *GCPServiceAccountMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { AccessibleProjects []string `json:"accessible_projects,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_delegate_account.go b/api/datadogV2/model_gcpsts_delegate_account.go index 1f24c70dc32..503cd754d62 100644 --- a/api/datadogV2/model_gcpsts_delegate_account.go +++ b/api/datadogV2/model_gcpsts_delegate_account.go @@ -158,8 +158,7 @@ func (o *GCPSTSDelegateAccount) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *GCPSTSDelegateAccountType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_delegate_account_attributes.go b/api/datadogV2/model_gcpsts_delegate_account_attributes.go index edd5e399ec6..7b7e6085a56 100644 --- a/api/datadogV2/model_gcpsts_delegate_account_attributes.go +++ b/api/datadogV2/model_gcpsts_delegate_account_attributes.go @@ -86,8 +86,7 @@ func (o *GCPSTSDelegateAccountAttributes) UnmarshalJSON(bytes []byte) (err error all := struct { DelegateAccountEmail *string `json:"delegate_account_email,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_delegate_account_response.go b/api/datadogV2/model_gcpsts_delegate_account_response.go index ce0f3ca6bae..e4bdb1e55ea 100644 --- a/api/datadogV2/model_gcpsts_delegate_account_response.go +++ b/api/datadogV2/model_gcpsts_delegate_account_response.go @@ -86,8 +86,7 @@ func (o *GCPSTSDelegateAccountResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data *GCPSTSDelegateAccount `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account.go b/api/datadogV2/model_gcpsts_service_account.go index 55fd52e2469..55fabe68f4f 100644 --- a/api/datadogV2/model_gcpsts_service_account.go +++ b/api/datadogV2/model_gcpsts_service_account.go @@ -192,8 +192,7 @@ func (o *GCPSTSServiceAccount) UnmarshalJSON(bytes []byte) (err error) { Meta *GCPServiceAccountMeta `json:"meta,omitempty"` Type *GCPServiceAccountType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account_attributes.go b/api/datadogV2/model_gcpsts_service_account_attributes.go index b4787991cf7..789ac0009e8 100644 --- a/api/datadogV2/model_gcpsts_service_account_attributes.go +++ b/api/datadogV2/model_gcpsts_service_account_attributes.go @@ -188,8 +188,7 @@ func (o *GCPSTSServiceAccountAttributes) UnmarshalJSON(bytes []byte) (err error) HostFilters []string `json:"host_filters,omitempty"` IsCspmEnabled *bool `json:"is_cspm_enabled,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account_create_request.go b/api/datadogV2/model_gcpsts_service_account_create_request.go index 13d35b6ade5..c1dc5236ef4 100644 --- a/api/datadogV2/model_gcpsts_service_account_create_request.go +++ b/api/datadogV2/model_gcpsts_service_account_create_request.go @@ -86,8 +86,7 @@ func (o *GCPSTSServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err err all := struct { Data *GCPSTSServiceAccountData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account_data.go b/api/datadogV2/model_gcpsts_service_account_data.go index 73dfe4c5e13..a0821d0676a 100644 --- a/api/datadogV2/model_gcpsts_service_account_data.go +++ b/api/datadogV2/model_gcpsts_service_account_data.go @@ -124,8 +124,7 @@ func (o *GCPSTSServiceAccountData) UnmarshalJSON(bytes []byte) (err error) { Attributes *GCPSTSServiceAccountAttributes `json:"attributes,omitempty"` Type *GCPServiceAccountType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account_response.go b/api/datadogV2/model_gcpsts_service_account_response.go index 44e522de1ec..0f8fb8cda3e 100644 --- a/api/datadogV2/model_gcpsts_service_account_response.go +++ b/api/datadogV2/model_gcpsts_service_account_response.go @@ -86,8 +86,7 @@ func (o *GCPSTSServiceAccountResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *GCPSTSServiceAccount `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account_update_request.go b/api/datadogV2/model_gcpsts_service_account_update_request.go index 2a9948278f2..11cd62e24eb 100644 --- a/api/datadogV2/model_gcpsts_service_account_update_request.go +++ b/api/datadogV2/model_gcpsts_service_account_update_request.go @@ -86,8 +86,7 @@ func (o *GCPSTSServiceAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err err all := struct { Data *GCPSTSServiceAccountUpdateRequestData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_account_update_request_data.go b/api/datadogV2/model_gcpsts_service_account_update_request_data.go index c30fdbab5b3..0786bb9ac8e 100644 --- a/api/datadogV2/model_gcpsts_service_account_update_request_data.go +++ b/api/datadogV2/model_gcpsts_service_account_update_request_data.go @@ -158,8 +158,7 @@ func (o *GCPSTSServiceAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err Id *string `json:"id,omitempty"` Type *GCPServiceAccountType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_gcpsts_service_accounts_response.go b/api/datadogV2/model_gcpsts_service_accounts_response.go index c979179b001..d9b636af7e0 100644 --- a/api/datadogV2/model_gcpsts_service_accounts_response.go +++ b/api/datadogV2/model_gcpsts_service_accounts_response.go @@ -86,8 +86,7 @@ func (o *GCPSTSServiceAccountsResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data []GCPSTSServiceAccount `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_get_finding_response.go b/api/datadogV2/model_get_finding_response.go index 4ff0957f7b4..ed5d531f39c 100644 --- a/api/datadogV2/model_get_finding_response.go +++ b/api/datadogV2/model_get_finding_response.go @@ -78,21 +78,10 @@ func (o GetFindingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *GetFindingResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *DetailedFinding `json:"data"` - }{} all := struct { - Data DetailedFinding `json:"data"` + Data *DetailedFinding `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *GetFindingResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *GetFindingResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_group_scalar_column.go b/api/datadogV2/model_group_scalar_column.go index 5fc7fed35f6..efae87b49cd 100644 --- a/api/datadogV2/model_group_scalar_column.go +++ b/api/datadogV2/model_group_scalar_column.go @@ -154,8 +154,7 @@ func (o *GroupScalarColumn) UnmarshalJSON(bytes []byte) (err error) { Type *string `json:"type,omitempty"` Values [][]string `json:"values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_hourly_usage.go b/api/datadogV2/model_hourly_usage.go index 6153aedf8cc..c0069bd1bf2 100644 --- a/api/datadogV2/model_hourly_usage.go +++ b/api/datadogV2/model_hourly_usage.go @@ -158,8 +158,7 @@ func (o *HourlyUsage) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *UsageTimeSeriesType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_hourly_usage_attributes.go b/api/datadogV2/model_hourly_usage_attributes.go index b55f5f9fb38..a2e639d1581 100644 --- a/api/datadogV2/model_hourly_usage_attributes.go +++ b/api/datadogV2/model_hourly_usage_attributes.go @@ -261,8 +261,7 @@ func (o *HourlyUsageAttributes) UnmarshalJSON(bytes []byte) (err error) { Region *string `json:"region,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_hourly_usage_measurement.go b/api/datadogV2/model_hourly_usage_measurement.go index d5b5065cc01..32b78c72547 100644 --- a/api/datadogV2/model_hourly_usage_measurement.go +++ b/api/datadogV2/model_hourly_usage_measurement.go @@ -131,8 +131,7 @@ func (o *HourlyUsageMeasurement) UnmarshalJSON(bytes []byte) (err error) { UsageType *string `json:"usage_type,omitempty"` Value datadog.NullableInt64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_hourly_usage_metadata.go b/api/datadogV2/model_hourly_usage_metadata.go index 1975abd9de7..137614e20cf 100644 --- a/api/datadogV2/model_hourly_usage_metadata.go +++ b/api/datadogV2/model_hourly_usage_metadata.go @@ -86,8 +86,7 @@ func (o *HourlyUsageMetadata) UnmarshalJSON(bytes []byte) (err error) { all := struct { Pagination *HourlyUsagePagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_hourly_usage_pagination.go b/api/datadogV2/model_hourly_usage_pagination.go index d76b4f21161..af9b625ee01 100644 --- a/api/datadogV2/model_hourly_usage_pagination.go +++ b/api/datadogV2/model_hourly_usage_pagination.go @@ -97,8 +97,7 @@ func (o *HourlyUsagePagination) UnmarshalJSON(bytes []byte) (err error) { all := struct { NextRecordId datadog.NullableString `json:"next_record_id,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_hourly_usage_response.go b/api/datadogV2/model_hourly_usage_response.go index d57eb1ce149..8fc93128c3b 100644 --- a/api/datadogV2/model_hourly_usage_response.go +++ b/api/datadogV2/model_hourly_usage_response.go @@ -120,8 +120,7 @@ func (o *HourlyUsageResponse) UnmarshalJSON(bytes []byte) (err error) { Data []HourlyUsage `json:"data,omitempty"` Meta *HourlyUsageMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_http_log_error.go b/api/datadogV2/model_http_log_error.go index a4880a8af5f..ac9fba35217 100644 --- a/api/datadogV2/model_http_log_error.go +++ b/api/datadogV2/model_http_log_error.go @@ -154,8 +154,7 @@ func (o *HTTPLogError) UnmarshalJSON(bytes []byte) (err error) { Status *string `json:"status,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_http_log_errors.go b/api/datadogV2/model_http_log_errors.go index ef896bf5544..e066d87432c 100644 --- a/api/datadogV2/model_http_log_errors.go +++ b/api/datadogV2/model_http_log_errors.go @@ -86,8 +86,7 @@ func (o *HTTPLogErrors) UnmarshalJSON(bytes []byte) (err error) { all := struct { Errors []HTTPLogError `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_http_log_item.go b/api/datadogV2/model_http_log_item.go index aedcb3d9592..15c11c4dcae 100644 --- a/api/datadogV2/model_http_log_item.go +++ b/api/datadogV2/model_http_log_item.go @@ -216,25 +216,14 @@ func (o HTTPLogItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Message *string `json:"message"` - }{} all := struct { Ddsource *string `json:"ddsource,omitempty"` Ddtags *string `json:"ddtags,omitempty"` Hostname *string `json:"hostname,omitempty"` - Message string `json:"message"` + Message *string `json:"message"` Service *string `json:"service,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Message == nil { - return fmt.Errorf("required field message missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -242,6 +231,9 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Message == nil { + return fmt.Errorf("required field message missing") + } additionalProperties := make(map[string]string) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"ddsource", "ddtags", "hostname", "message", "service"}) @@ -251,7 +243,7 @@ func (o *HTTPLogItem) UnmarshalJSON(bytes []byte) (err error) { o.Ddsource = all.Ddsource o.Ddtags = all.Ddtags o.Hostname = all.Hostname - o.Message = all.Message + o.Message = *all.Message o.Service = all.Service if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_httpci_app_error.go b/api/datadogV2/model_httpci_app_error.go index a420ac6ec7f..75fd89d56b3 100644 --- a/api/datadogV2/model_httpci_app_error.go +++ b/api/datadogV2/model_httpci_app_error.go @@ -154,8 +154,7 @@ func (o *HTTPCIAppError) UnmarshalJSON(bytes []byte) (err error) { Status *string `json:"status,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_httpci_app_errors.go b/api/datadogV2/model_httpci_app_errors.go index 92041886948..2a02a898116 100644 --- a/api/datadogV2/model_httpci_app_errors.go +++ b/api/datadogV2/model_httpci_app_errors.go @@ -86,8 +86,7 @@ func (o *HTTPCIAppErrors) UnmarshalJSON(bytes []byte) (err error) { all := struct { Errors []HTTPCIAppError `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_id_p_metadata_form_data.go b/api/datadogV2/model_id_p_metadata_form_data.go index 465dbb513e9..82d70a304b2 100644 --- a/api/datadogV2/model_id_p_metadata_form_data.go +++ b/api/datadogV2/model_id_p_metadata_form_data.go @@ -87,8 +87,7 @@ func (o *IdPMetadataFormData) UnmarshalJSON(bytes []byte) (err error) { all := struct { IdpFile **os.File `json:"idp_file,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_attachment_data.go b/api/datadogV2/model_incident_attachment_data.go index 1996b8f91ce..1c6ddbf70df 100644 --- a/api/datadogV2/model_incident_attachment_data.go +++ b/api/datadogV2/model_incident_attachment_data.go @@ -161,43 +161,32 @@ func (o IncidentAttachmentData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *IncidentAttachmentAttributes `json:"attributes"` Id *string `json:"id"` Relationships *IncidentAttachmentRelationships `json:"relationships"` Type *IncidentAttachmentType `json:"type"` }{} - all := struct { - Attributes IncidentAttachmentAttributes `json:"attributes"` - Id string `json:"id"` - Relationships IncidentAttachmentRelationships `json:"relationships"` - Type IncidentAttachmentType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Attributes == nil { + if all.Attributes == nil { return fmt.Errorf("required field attributes missing") } - if required.Id == nil { + if all.Id == nil { return fmt.Errorf("required field id missing") } - if required.Relationships == nil { + if all.Relationships == nil { return fmt.Errorf("required field relationships missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -212,8 +201,8 @@ func (o *IncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Attributes = all.Attributes - o.Id = all.Id + o.Attributes = *all.Attributes + o.Id = *all.Id if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -221,8 +210,8 @@ func (o *IncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Relationships = all.Relationships - o.Type = all.Type + o.Relationships = *all.Relationships + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachment_link_attributes.go b/api/datadogV2/model_incident_attachment_link_attributes.go index fe57ad36853..f6d630fb74e 100644 --- a/api/datadogV2/model_incident_attachment_link_attributes.go +++ b/api/datadogV2/model_incident_attachment_link_attributes.go @@ -107,26 +107,11 @@ func (o IncidentAttachmentLinkAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attachment *IncidentAttachmentLinkAttributesAttachmentObject `json:"attachment"` AttachmentType *IncidentAttachmentLinkAttachmentType `json:"attachment_type"` }{} - all := struct { - Attachment IncidentAttachmentLinkAttributesAttachmentObject `json:"attachment"` - AttachmentType IncidentAttachmentLinkAttachmentType `json:"attachment_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attachment == nil { - return fmt.Errorf("required field attachment missing") - } - if required.AttachmentType == nil { - return fmt.Errorf("required field attachment_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IncidentAttachmentLinkAttributes) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Attachment == nil { + return fmt.Errorf("required field attachment missing") + } + if all.AttachmentType == nil { + return fmt.Errorf("required field attachment_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attachment", "attachment_type"}) @@ -155,8 +146,8 @@ func (o *IncidentAttachmentLinkAttributes) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Attachment = all.Attachment - o.AttachmentType = all.AttachmentType + o.Attachment = *all.Attachment + o.AttachmentType = *all.AttachmentType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go b/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go index b69d4a80d21..70344b48f3d 100644 --- a/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go +++ b/api/datadogV2/model_incident_attachment_link_attributes_attachment_object.go @@ -105,26 +105,11 @@ func (o IncidentAttachmentLinkAttributesAttachmentObject) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentLinkAttributesAttachmentObject) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { DocumentUrl *string `json:"documentUrl"` Title *string `json:"title"` }{} - all := struct { - DocumentUrl string `json:"documentUrl"` - Title string `json:"title"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DocumentUrl == nil { - return fmt.Errorf("required field documentUrl missing") - } - if required.Title == nil { - return fmt.Errorf("required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *IncidentAttachmentLinkAttributesAttachmentObject) UnmarshalJSON(bytes [ o.UnparsedObject = raw return nil } + if all.DocumentUrl == nil { + return fmt.Errorf("required field documentUrl missing") + } + if all.Title == nil { + return fmt.Errorf("required field title missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"documentUrl", "title"}) } else { return err } - o.DocumentUrl = all.DocumentUrl - o.Title = all.Title + o.DocumentUrl = *all.DocumentUrl + o.Title = *all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachment_postmortem_attributes.go b/api/datadogV2/model_incident_attachment_postmortem_attributes.go index e78761f6092..ea690ae8ee5 100644 --- a/api/datadogV2/model_incident_attachment_postmortem_attributes.go +++ b/api/datadogV2/model_incident_attachment_postmortem_attributes.go @@ -107,26 +107,11 @@ func (o IncidentAttachmentPostmortemAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentPostmortemAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attachment *IncidentAttachmentsPostmortemAttributesAttachmentObject `json:"attachment"` AttachmentType *IncidentAttachmentPostmortemAttachmentType `json:"attachment_type"` }{} - all := struct { - Attachment IncidentAttachmentsPostmortemAttributesAttachmentObject `json:"attachment"` - AttachmentType IncidentAttachmentPostmortemAttachmentType `json:"attachment_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attachment == nil { - return fmt.Errorf("required field attachment missing") - } - if required.AttachmentType == nil { - return fmt.Errorf("required field attachment_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IncidentAttachmentPostmortemAttributes) UnmarshalJSON(bytes []byte) (er o.UnparsedObject = raw return nil } + if all.Attachment == nil { + return fmt.Errorf("required field attachment missing") + } + if all.AttachmentType == nil { + return fmt.Errorf("required field attachment_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attachment", "attachment_type"}) @@ -155,8 +146,8 @@ func (o *IncidentAttachmentPostmortemAttributes) UnmarshalJSON(bytes []byte) (er } o.UnparsedObject = raw } - o.Attachment = all.Attachment - o.AttachmentType = all.AttachmentType + o.Attachment = *all.Attachment + o.AttachmentType = *all.AttachmentType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachment_relationships.go b/api/datadogV2/model_incident_attachment_relationships.go index 719d9c7b3ca..3672d9eb05b 100644 --- a/api/datadogV2/model_incident_attachment_relationships.go +++ b/api/datadogV2/model_incident_attachment_relationships.go @@ -86,8 +86,7 @@ func (o *IncidentAttachmentRelationships) UnmarshalJSON(bytes []byte) (err error all := struct { LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_attachment_update_data.go b/api/datadogV2/model_incident_attachment_update_data.go index 2a78c3e1c7f..fa69d0c84a7 100644 --- a/api/datadogV2/model_incident_attachment_update_data.go +++ b/api/datadogV2/model_incident_attachment_update_data.go @@ -146,23 +146,12 @@ func (o IncidentAttachmentUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IncidentAttachmentType `json:"type"` - }{} all := struct { Attributes *IncidentAttachmentUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` - Type IncidentAttachmentType `json:"type"` + Type *IncidentAttachmentType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *IncidentAttachmentUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -186,7 +178,7 @@ func (o *IncidentAttachmentUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachment_update_request.go b/api/datadogV2/model_incident_attachment_update_request.go index 1b7d5219d55..b342e368e8a 100644 --- a/api/datadogV2/model_incident_attachment_update_request.go +++ b/api/datadogV2/model_incident_attachment_update_request.go @@ -81,21 +81,10 @@ func (o IncidentAttachmentUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentAttachmentUpdateData `json:"data"` - }{} all := struct { - Data []IncidentAttachmentUpdateData `json:"data"` + Data *[]IncidentAttachmentUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -103,13 +92,16 @@ func (o *IncidentAttachmentUpdateRequest) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachment_update_response.go b/api/datadogV2/model_incident_attachment_update_response.go index 8fd40ecc8e0..f1736588f4e 100644 --- a/api/datadogV2/model_incident_attachment_update_response.go +++ b/api/datadogV2/model_incident_attachment_update_response.go @@ -112,22 +112,11 @@ func (o IncidentAttachmentUpdateResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentAttachmentData `json:"data"` - }{} all := struct { - Data []IncidentAttachmentData `json:"data"` + Data *[]IncidentAttachmentData `json:"data"` Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -135,13 +124,16 @@ func (o *IncidentAttachmentUpdateResponse) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go b/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go index 5f8dcb1751c..85bfa9a36e1 100644 --- a/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go +++ b/api/datadogV2/model_incident_attachments_postmortem_attributes_attachment_object.go @@ -105,26 +105,11 @@ func (o IncidentAttachmentsPostmortemAttributesAttachmentObject) MarshalJSON() ( // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentsPostmortemAttributesAttachmentObject) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { DocumentUrl *string `json:"documentUrl"` Title *string `json:"title"` }{} - all := struct { - DocumentUrl string `json:"documentUrl"` - Title string `json:"title"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DocumentUrl == nil { - return fmt.Errorf("required field documentUrl missing") - } - if required.Title == nil { - return fmt.Errorf("required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *IncidentAttachmentsPostmortemAttributesAttachmentObject) UnmarshalJSON( o.UnparsedObject = raw return nil } + if all.DocumentUrl == nil { + return fmt.Errorf("required field documentUrl missing") + } + if all.Title == nil { + return fmt.Errorf("required field title missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"documentUrl", "title"}) } else { return err } - o.DocumentUrl = all.DocumentUrl - o.Title = all.Title + o.DocumentUrl = *all.DocumentUrl + o.Title = *all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_attachments_response.go b/api/datadogV2/model_incident_attachments_response.go index a64dc768ad6..62ec36d2b8b 100644 --- a/api/datadogV2/model_incident_attachments_response.go +++ b/api/datadogV2/model_incident_attachments_response.go @@ -111,22 +111,11 @@ func (o IncidentAttachmentsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentAttachmentsResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentAttachmentData `json:"data"` - }{} all := struct { - Data []IncidentAttachmentData `json:"data"` + Data *[]IncidentAttachmentData `json:"data"` Included []IncidentAttachmentsResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *IncidentAttachmentsResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_create_attributes.go b/api/datadogV2/model_incident_create_attributes.go index d872bcf9c04..0b47bb9c8b2 100644 --- a/api/datadogV2/model_incident_create_attributes.go +++ b/api/datadogV2/model_incident_create_attributes.go @@ -237,30 +237,15 @@ func (o IncidentCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - CustomerImpacted *bool `json:"customer_impacted"` - Title *string `json:"title"` - }{} all := struct { CustomerImpactScope *string `json:"customer_impact_scope,omitempty"` - CustomerImpacted bool `json:"customer_impacted"` + CustomerImpacted *bool `json:"customer_impacted"` Fields map[string]IncidentFieldAttributes `json:"fields,omitempty"` InitialCells []IncidentTimelineCellCreateAttributes `json:"initial_cells,omitempty"` NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` - Title string `json:"title"` + Title *string `json:"title"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.CustomerImpacted == nil { - return fmt.Errorf("required field customer_impacted missing") - } - if required.Title == nil { - return fmt.Errorf("required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -268,6 +253,12 @@ func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.CustomerImpacted == nil { + return fmt.Errorf("required field customer_impacted missing") + } + if all.Title == nil { + return fmt.Errorf("required field title missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"customer_impact_scope", "customer_impacted", "fields", "initial_cells", "notification_handles", "title"}) @@ -275,11 +266,11 @@ func (o *IncidentCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.CustomerImpactScope = all.CustomerImpactScope - o.CustomerImpacted = all.CustomerImpacted + o.CustomerImpacted = *all.CustomerImpacted o.Fields = all.Fields o.InitialCells = all.InitialCells o.NotificationHandles = all.NotificationHandles - o.Title = all.Title + o.Title = *all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_create_data.go b/api/datadogV2/model_incident_create_data.go index 8d3bf1b22aa..a3217b7088c 100644 --- a/api/datadogV2/model_incident_create_data.go +++ b/api/datadogV2/model_incident_create_data.go @@ -140,27 +140,12 @@ func (o IncidentCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *IncidentCreateAttributes `json:"attributes"` - Type *IncidentType `json:"type"` - }{} all := struct { - Attributes IncidentCreateAttributes `json:"attributes"` + Attributes *IncidentCreateAttributes `json:"attributes"` Relationships *IncidentCreateRelationships `json:"relationships,omitempty"` - Type IncidentType `json:"type"` + Type *IncidentType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -189,7 +180,7 @@ func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -198,7 +189,7 @@ func (o *IncidentCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_create_relationships.go b/api/datadogV2/model_incident_create_relationships.go index 1421271fa72..f7fd0cb580b 100644 --- a/api/datadogV2/model_incident_create_relationships.go +++ b/api/datadogV2/model_incident_create_relationships.go @@ -78,21 +78,10 @@ func (o IncidentCreateRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - CommanderUser *NullableRelationshipToUser `json:"commander_user"` - }{} all := struct { - CommanderUser NullableRelationshipToUser `json:"commander_user"` + CommanderUser *NullableRelationshipToUser `json:"commander_user"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.CommanderUser == nil { - return fmt.Errorf("required field commander_user missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.CommanderUser == nil { + return fmt.Errorf("required field commander_user missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"commander_user"}) @@ -113,7 +105,7 @@ func (o *IncidentCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.CommanderUser = all.CommanderUser + o.CommanderUser = *all.CommanderUser if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_create_request.go b/api/datadogV2/model_incident_create_request.go index 4f84eb91b20..474a8e04260 100644 --- a/api/datadogV2/model_incident_create_request.go +++ b/api/datadogV2/model_incident_create_request.go @@ -78,21 +78,10 @@ func (o IncidentCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentCreateData `json:"data"` - }{} all := struct { - Data IncidentCreateData `json:"data"` + Data *IncidentCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_field_attributes_multiple_value.go b/api/datadogV2/model_incident_field_attributes_multiple_value.go index 200a36dddea..b1b80983ad8 100644 --- a/api/datadogV2/model_incident_field_attributes_multiple_value.go +++ b/api/datadogV2/model_incident_field_attributes_multiple_value.go @@ -135,8 +135,7 @@ func (o *IncidentFieldAttributesMultipleValue) UnmarshalJSON(bytes []byte) (err Type *IncidentFieldAttributesValueType `json:"type,omitempty"` Value datadog.NullableList[string] `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_field_attributes_single_value.go b/api/datadogV2/model_incident_field_attributes_single_value.go index f6876d291d6..e18fb97f96b 100644 --- a/api/datadogV2/model_incident_field_attributes_single_value.go +++ b/api/datadogV2/model_incident_field_attributes_single_value.go @@ -135,8 +135,7 @@ func (o *IncidentFieldAttributesSingleValue) UnmarshalJSON(bytes []byte) (err er Type *IncidentFieldAttributesSingleValueType `json:"type,omitempty"` Value datadog.NullableString `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_integration_metadata_attributes.go b/api/datadogV2/model_incident_integration_metadata_attributes.go index 6abf43502fd..308a5c94531 100644 --- a/api/datadogV2/model_incident_integration_metadata_attributes.go +++ b/api/datadogV2/model_incident_integration_metadata_attributes.go @@ -174,28 +174,13 @@ func (o IncidentIntegrationMetadataAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { + IncidentId *string `json:"incident_id,omitempty"` IntegrationType *int32 `json:"integration_type"` Metadata *IncidentIntegrationMetadataMetadata `json:"metadata"` + Status *int32 `json:"status,omitempty"` }{} - all := struct { - IncidentId *string `json:"incident_id,omitempty"` - IntegrationType int32 `json:"integration_type"` - Metadata IncidentIntegrationMetadataMetadata `json:"metadata"` - Status *int32 `json:"status,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IntegrationType == nil { - return fmt.Errorf("required field integration_type missing") - } - if required.Metadata == nil { - return fmt.Errorf("required field metadata missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -203,6 +188,12 @@ func (o *IncidentIntegrationMetadataAttributes) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.IntegrationType == nil { + return fmt.Errorf("required field integration_type missing") + } + if all.Metadata == nil { + return fmt.Errorf("required field metadata missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"incident_id", "integration_type", "metadata", "status"}) @@ -210,8 +201,8 @@ func (o *IncidentIntegrationMetadataAttributes) UnmarshalJSON(bytes []byte) (err return err } o.IncidentId = all.IncidentId - o.IntegrationType = all.IntegrationType - o.Metadata = all.Metadata + o.IntegrationType = *all.IntegrationType + o.Metadata = *all.Metadata o.Status = all.Status if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_integration_metadata_create_data.go b/api/datadogV2/model_incident_integration_metadata_create_data.go index 1c77d2e1fa3..a4233f6d179 100644 --- a/api/datadogV2/model_incident_integration_metadata_create_data.go +++ b/api/datadogV2/model_incident_integration_metadata_create_data.go @@ -107,26 +107,11 @@ func (o IncidentIntegrationMetadataCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *IncidentIntegrationMetadataAttributes `json:"attributes"` Type *IncidentIntegrationMetadataType `json:"type"` }{} - all := struct { - Attributes IncidentIntegrationMetadataAttributes `json:"attributes"` - Type IncidentIntegrationMetadataType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IncidentIntegrationMetadataCreateData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *IncidentIntegrationMetadataCreateData) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_integration_metadata_create_request.go b/api/datadogV2/model_incident_integration_metadata_create_request.go index 47d65c1f3a0..38da2316bdd 100644 --- a/api/datadogV2/model_incident_integration_metadata_create_request.go +++ b/api/datadogV2/model_incident_integration_metadata_create_request.go @@ -78,21 +78,10 @@ func (o IncidentIntegrationMetadataCreateRequest) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentIntegrationMetadataCreateData `json:"data"` - }{} all := struct { - Data IncidentIntegrationMetadataCreateData `json:"data"` + Data *IncidentIntegrationMetadataCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentIntegrationMetadataCreateRequest) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentIntegrationMetadataCreateRequest) UnmarshalJSON(bytes []byte) ( } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_integration_metadata_list_response.go b/api/datadogV2/model_incident_integration_metadata_list_response.go index 7c097b689a2..d755fab8f3f 100644 --- a/api/datadogV2/model_incident_integration_metadata_list_response.go +++ b/api/datadogV2/model_incident_integration_metadata_list_response.go @@ -144,23 +144,12 @@ func (o IncidentIntegrationMetadataListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataListResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentIntegrationMetadataResponseData `json:"data"` - }{} all := struct { - Data []IncidentIntegrationMetadataResponseData `json:"data"` + Data *[]IncidentIntegrationMetadataResponseData `json:"data"` Included []IncidentIntegrationMetadataResponseIncludedItem `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *IncidentIntegrationMetadataListResponse) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_incident_integration_metadata_patch_data.go b/api/datadogV2/model_incident_integration_metadata_patch_data.go index 484d76fb759..75919de3082 100644 --- a/api/datadogV2/model_incident_integration_metadata_patch_data.go +++ b/api/datadogV2/model_incident_integration_metadata_patch_data.go @@ -107,26 +107,11 @@ func (o IncidentIntegrationMetadataPatchData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataPatchData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *IncidentIntegrationMetadataAttributes `json:"attributes"` Type *IncidentIntegrationMetadataType `json:"type"` }{} - all := struct { - Attributes IncidentIntegrationMetadataAttributes `json:"attributes"` - Type IncidentIntegrationMetadataType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IncidentIntegrationMetadataPatchData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *IncidentIntegrationMetadataPatchData) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_integration_metadata_patch_request.go b/api/datadogV2/model_incident_integration_metadata_patch_request.go index 08a4f7e458d..dbc78d3e43b 100644 --- a/api/datadogV2/model_incident_integration_metadata_patch_request.go +++ b/api/datadogV2/model_incident_integration_metadata_patch_request.go @@ -78,21 +78,10 @@ func (o IncidentIntegrationMetadataPatchRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataPatchRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentIntegrationMetadataPatchData `json:"data"` - }{} all := struct { - Data IncidentIntegrationMetadataPatchData `json:"data"` + Data *IncidentIntegrationMetadataPatchData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentIntegrationMetadataPatchRequest) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentIntegrationMetadataPatchRequest) UnmarshalJSON(bytes []byte) (e } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_integration_metadata_response.go b/api/datadogV2/model_incident_integration_metadata_response.go index 20433f31d9a..4e09f245d56 100644 --- a/api/datadogV2/model_incident_integration_metadata_response.go +++ b/api/datadogV2/model_incident_integration_metadata_response.go @@ -111,22 +111,11 @@ func (o IncidentIntegrationMetadataResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentIntegrationMetadataResponseData `json:"data"` - }{} all := struct { - Data IncidentIntegrationMetadataResponseData `json:"data"` + Data *IncidentIntegrationMetadataResponseData `json:"data"` Included []IncidentIntegrationMetadataResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *IncidentIntegrationMetadataResponse) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) @@ -147,7 +139,7 @@ func (o *IncidentIntegrationMetadataResponse) UnmarshalJSON(bytes []byte) (err e } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_integration_metadata_response_data.go b/api/datadogV2/model_incident_integration_metadata_response_data.go index 3f84e0bb29d..2443a3cd111 100644 --- a/api/datadogV2/model_incident_integration_metadata_response_data.go +++ b/api/datadogV2/model_incident_integration_metadata_response_data.go @@ -140,27 +140,12 @@ func (o IncidentIntegrationMetadataResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentIntegrationMetadataResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentIntegrationMetadataType `json:"type"` - }{} all := struct { Attributes *IncidentIntegrationMetadataAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type IncidentIntegrationMetadataType `json:"type"` + Id *string `json:"id"` + Type *IncidentIntegrationMetadataType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *IncidentIntegrationMetadataResponseData) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *IncidentIntegrationMetadataResponseData) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_notification_handle.go b/api/datadogV2/model_incident_notification_handle.go index bd1d7b92d78..73feac114ae 100644 --- a/api/datadogV2/model_incident_notification_handle.go +++ b/api/datadogV2/model_incident_notification_handle.go @@ -120,8 +120,7 @@ func (o *IncidentNotificationHandle) UnmarshalJSON(bytes []byte) (err error) { DisplayName *string `json:"display_name,omitempty"` Handle *string `json:"handle,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_response.go b/api/datadogV2/model_incident_response.go index fc968d8d8e0..9c5cf20358c 100644 --- a/api/datadogV2/model_incident_response.go +++ b/api/datadogV2/model_incident_response.go @@ -111,22 +111,11 @@ func (o IncidentResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentResponseData `json:"data"` - }{} all := struct { - Data IncidentResponseData `json:"data"` + Data *IncidentResponseData `json:"data"` Included []IncidentResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) @@ -147,7 +139,7 @@ func (o *IncidentResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_response_attributes.go b/api/datadogV2/model_incident_response_attributes.go index 7417cf39559..0d5ad63b26b 100644 --- a/api/datadogV2/model_incident_response_attributes.go +++ b/api/datadogV2/model_incident_response_attributes.go @@ -673,9 +673,6 @@ func (o IncidentResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Title *string `json:"title"` - }{} all := struct { Created *time.Time `json:"created,omitempty"` CustomerImpactDuration *int64 `json:"customer_impact_duration,omitempty"` @@ -693,17 +690,9 @@ func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { TimeToInternalResponse *int64 `json:"time_to_internal_response,omitempty"` TimeToRepair *int64 `json:"time_to_repair,omitempty"` TimeToResolve *int64 `json:"time_to_resolve,omitempty"` - Title string `json:"title"` + Title *string `json:"title"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Title == nil { - return fmt.Errorf("required field title missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -711,6 +700,9 @@ func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Title == nil { + return fmt.Errorf("required field title missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"created", "customer_impact_duration", "customer_impact_end", "customer_impact_scope", "customer_impact_start", "customer_impacted", "detected", "fields", "modified", "notification_handles", "public_id", "resolved", "time_to_detect", "time_to_internal_response", "time_to_repair", "time_to_resolve", "title"}) @@ -733,7 +725,7 @@ func (o *IncidentResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { o.TimeToInternalResponse = all.TimeToInternalResponse o.TimeToRepair = all.TimeToRepair o.TimeToResolve = all.TimeToResolve - o.Title = all.Title + o.Title = *all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_response_data.go b/api/datadogV2/model_incident_response_data.go index 3886355aed8..cd870f5042a 100644 --- a/api/datadogV2/model_incident_response_data.go +++ b/api/datadogV2/model_incident_response_data.go @@ -173,28 +173,13 @@ func (o IncidentResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentType `json:"type"` - }{} all := struct { Attributes *IncidentResponseAttributes `json:"attributes,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` Relationships *IncidentResponseRelationships `json:"relationships,omitempty"` - Type IncidentType `json:"type"` + Type *IncidentType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +187,12 @@ func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -224,7 +215,7 @@ func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -233,7 +224,7 @@ func (o *IncidentResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_response_meta.go b/api/datadogV2/model_incident_response_meta.go index 2975cbb626d..b11744cab32 100644 --- a/api/datadogV2/model_incident_response_meta.go +++ b/api/datadogV2/model_incident_response_meta.go @@ -86,8 +86,7 @@ func (o *IncidentResponseMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Pagination *IncidentResponseMetaPagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_response_meta_pagination.go b/api/datadogV2/model_incident_response_meta_pagination.go index b806a09580f..80ba8908dfe 100644 --- a/api/datadogV2/model_incident_response_meta_pagination.go +++ b/api/datadogV2/model_incident_response_meta_pagination.go @@ -154,8 +154,7 @@ func (o *IncidentResponseMetaPagination) UnmarshalJSON(bytes []byte) (err error) Offset *int64 `json:"offset,omitempty"` Size *int64 `json:"size,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_response_relationships.go b/api/datadogV2/model_incident_response_relationships.go index 6013633a42f..6dfd2237a10 100644 --- a/api/datadogV2/model_incident_response_relationships.go +++ b/api/datadogV2/model_incident_response_relationships.go @@ -222,8 +222,7 @@ func (o *IncidentResponseRelationships) UnmarshalJSON(bytes []byte) (err error) Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_search_response.go b/api/datadogV2/model_incident_search_response.go index aea3bf1e985..6c3fe19380e 100644 --- a/api/datadogV2/model_incident_search_response.go +++ b/api/datadogV2/model_incident_search_response.go @@ -144,23 +144,12 @@ func (o IncidentSearchResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentSearchResponseData `json:"data"` - }{} all := struct { - Data IncidentSearchResponseData `json:"data"` + Data *IncidentSearchResponseData `json:"data"` Included []IncidentResponseIncludedItem `json:"included,omitempty"` Meta *IncidentSearchResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *IncidentSearchResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) @@ -181,7 +173,7 @@ func (o *IncidentSearchResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_incident_search_response_attributes.go b/api/datadogV2/model_incident_search_response_attributes.go index 0e9a1519883..9dbe9ceb09e 100644 --- a/api/datadogV2/model_incident_search_response_attributes.go +++ b/api/datadogV2/model_incident_search_response_attributes.go @@ -132,31 +132,12 @@ func (o IncidentSearchResponseAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Facets *IncidentSearchResponseFacetsData `json:"facets"` Incidents *[]IncidentSearchResponseIncidentsData `json:"incidents"` Total *int32 `json:"total"` }{} - all := struct { - Facets IncidentSearchResponseFacetsData `json:"facets"` - Incidents []IncidentSearchResponseIncidentsData `json:"incidents"` - Total int32 `json:"total"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facets == nil { - return fmt.Errorf("required field facets missing") - } - if required.Incidents == nil { - return fmt.Errorf("required field incidents missing") - } - if required.Total == nil { - return fmt.Errorf("required field total missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -164,6 +145,15 @@ func (o *IncidentSearchResponseAttributes) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Facets == nil { + return fmt.Errorf("required field facets missing") + } + if all.Incidents == nil { + return fmt.Errorf("required field incidents missing") + } + if all.Total == nil { + return fmt.Errorf("required field total missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facets", "incidents", "total"}) @@ -177,9 +167,9 @@ func (o *IncidentSearchResponseAttributes) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Facets = all.Facets - o.Incidents = all.Incidents - o.Total = all.Total + o.Facets = *all.Facets + o.Incidents = *all.Incidents + o.Total = *all.Total if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_search_response_data.go b/api/datadogV2/model_incident_search_response_data.go index 943224b6d01..c44867f9751 100644 --- a/api/datadogV2/model_incident_search_response_data.go +++ b/api/datadogV2/model_incident_search_response_data.go @@ -124,8 +124,7 @@ func (o *IncidentSearchResponseData) UnmarshalJSON(bytes []byte) (err error) { Attributes *IncidentSearchResponseAttributes `json:"attributes,omitempty"` Type *IncidentSearchResultsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_search_response_facets_data.go b/api/datadogV2/model_incident_search_response_facets_data.go index 99d434def59..259cdebfd54 100644 --- a/api/datadogV2/model_incident_search_response_facets_data.go +++ b/api/datadogV2/model_incident_search_response_facets_data.go @@ -426,8 +426,7 @@ func (o *IncidentSearchResponseFacetsData) UnmarshalJSON(bytes []byte) (err erro TimeToRepair []IncidentSearchResponseNumericFacetData `json:"time_to_repair,omitempty"` TimeToResolve []IncidentSearchResponseNumericFacetData `json:"time_to_resolve,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_search_response_field_facet_data.go b/api/datadogV2/model_incident_search_response_field_facet_data.go index b7a983cec1a..107307b102c 100644 --- a/api/datadogV2/model_incident_search_response_field_facet_data.go +++ b/api/datadogV2/model_incident_search_response_field_facet_data.go @@ -120,8 +120,7 @@ func (o *IncidentSearchResponseFieldFacetData) UnmarshalJSON(bytes []byte) (err Count *int32 `json:"count,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_search_response_incidents_data.go b/api/datadogV2/model_incident_search_response_incidents_data.go index a35f4b0b256..63087d248c9 100644 --- a/api/datadogV2/model_incident_search_response_incidents_data.go +++ b/api/datadogV2/model_incident_search_response_incidents_data.go @@ -78,21 +78,10 @@ func (o IncidentSearchResponseIncidentsData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseIncidentsData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentResponseData `json:"data"` - }{} all := struct { - Data IncidentResponseData `json:"data"` + Data *IncidentResponseData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentSearchResponseIncidentsData) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentSearchResponseIncidentsData) UnmarshalJSON(bytes []byte) (err e } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_search_response_meta.go b/api/datadogV2/model_incident_search_response_meta.go index 51c1734bfa7..912a5cdd7d7 100644 --- a/api/datadogV2/model_incident_search_response_meta.go +++ b/api/datadogV2/model_incident_search_response_meta.go @@ -86,8 +86,7 @@ func (o *IncidentSearchResponseMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Pagination *IncidentResponseMetaPagination `json:"pagination,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_search_response_numeric_facet_data.go b/api/datadogV2/model_incident_search_response_numeric_facet_data.go index 4d5406844d0..e8610429adf 100644 --- a/api/datadogV2/model_incident_search_response_numeric_facet_data.go +++ b/api/datadogV2/model_incident_search_response_numeric_facet_data.go @@ -105,26 +105,11 @@ func (o IncidentSearchResponseNumericFacetData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponseNumericFacetData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Aggregates *IncidentSearchResponseNumericFacetDataAggregates `json:"aggregates"` Name *string `json:"name"` }{} - all := struct { - Aggregates IncidentSearchResponseNumericFacetDataAggregates `json:"aggregates"` - Name string `json:"name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregates == nil { - return fmt.Errorf("required field aggregates missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *IncidentSearchResponseNumericFacetData) UnmarshalJSON(bytes []byte) (er o.UnparsedObject = raw return nil } + if all.Aggregates == nil { + return fmt.Errorf("required field aggregates missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregates", "name"}) @@ -145,8 +136,8 @@ func (o *IncidentSearchResponseNumericFacetData) UnmarshalJSON(bytes []byte) (er } o.UnparsedObject = raw } - o.Aggregates = all.Aggregates - o.Name = all.Name + o.Aggregates = *all.Aggregates + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go b/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go index ee38f118bf3..fc7a2e02501 100644 --- a/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go +++ b/api/datadogV2/model_incident_search_response_numeric_facet_data_aggregates.go @@ -142,8 +142,7 @@ func (o *IncidentSearchResponseNumericFacetDataAggregates) UnmarshalJSON(bytes [ Max datadog.NullableFloat64 `json:"max,omitempty"` Min datadog.NullableFloat64 `json:"min,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_search_response_property_field_facet_data.go b/api/datadogV2/model_incident_search_response_property_field_facet_data.go index 5199a97a308..cf18337b231 100644 --- a/api/datadogV2/model_incident_search_response_property_field_facet_data.go +++ b/api/datadogV2/model_incident_search_response_property_field_facet_data.go @@ -138,27 +138,12 @@ func (o IncidentSearchResponsePropertyFieldFacetData) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *IncidentSearchResponsePropertyFieldFacetData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facets *[]IncidentSearchResponseFieldFacetData `json:"facets"` - Name *string `json:"name"` - }{} all := struct { Aggregates *IncidentSearchResponseNumericFacetDataAggregates `json:"aggregates,omitempty"` - Facets []IncidentSearchResponseFieldFacetData `json:"facets"` - Name string `json:"name"` + Facets *[]IncidentSearchResponseFieldFacetData `json:"facets"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facets == nil { - return fmt.Errorf("required field facets missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *IncidentSearchResponsePropertyFieldFacetData) UnmarshalJSON(bytes []byt o.UnparsedObject = raw return nil } + if all.Facets == nil { + return fmt.Errorf("required field facets missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregates", "facets", "name"}) @@ -180,8 +171,8 @@ func (o *IncidentSearchResponsePropertyFieldFacetData) UnmarshalJSON(bytes []byt o.UnparsedObject = raw } o.Aggregates = all.Aggregates - o.Facets = all.Facets - o.Name = all.Name + o.Facets = *all.Facets + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_search_response_user_facet_data.go b/api/datadogV2/model_incident_search_response_user_facet_data.go index 2c445c3ad3f..4192cfb6d09 100644 --- a/api/datadogV2/model_incident_search_response_user_facet_data.go +++ b/api/datadogV2/model_incident_search_response_user_facet_data.go @@ -222,8 +222,7 @@ func (o *IncidentSearchResponseUserFacetData) UnmarshalJSON(bytes []byte) (err e Name *string `json:"name,omitempty"` Uuid *string `json:"uuid,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_service_create_attributes.go b/api/datadogV2/model_incident_service_create_attributes.go index 3f1d2629c65..e03df447ded 100644 --- a/api/datadogV2/model_incident_service_create_attributes.go +++ b/api/datadogV2/model_incident_service_create_attributes.go @@ -78,21 +78,10 @@ func (o IncidentServiceCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *IncidentServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_service_create_data.go b/api/datadogV2/model_incident_service_create_data.go index 049d5de842c..3b4a2291447 100644 --- a/api/datadogV2/model_incident_service_create_data.go +++ b/api/datadogV2/model_incident_service_create_data.go @@ -146,23 +146,12 @@ func (o IncidentServiceCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IncidentServiceType `json:"type"` - }{} all := struct { Attributes *IncidentServiceCreateAttributes `json:"attributes,omitempty"` Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type IncidentServiceType `json:"type"` + Type *IncidentServiceType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -200,7 +192,7 @@ func (o *IncidentServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_service_create_request.go b/api/datadogV2/model_incident_service_create_request.go index fec03dd58db..ddb9d475a4d 100644 --- a/api/datadogV2/model_incident_service_create_request.go +++ b/api/datadogV2/model_incident_service_create_request.go @@ -78,21 +78,10 @@ func (o IncidentServiceCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentServiceCreateData `json:"data"` - }{} all := struct { - Data IncidentServiceCreateData `json:"data"` + Data *IncidentServiceCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_service_relationships.go b/api/datadogV2/model_incident_service_relationships.go index 0c8db4451e0..634bdd0bb5a 100644 --- a/api/datadogV2/model_incident_service_relationships.go +++ b/api/datadogV2/model_incident_service_relationships.go @@ -120,8 +120,7 @@ func (o *IncidentServiceRelationships) UnmarshalJSON(bytes []byte) (err error) { CreatedBy *RelationshipToUser `json:"created_by,omitempty"` LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_service_response.go b/api/datadogV2/model_incident_service_response.go index bcad2d6cd35..a05465ee96a 100644 --- a/api/datadogV2/model_incident_service_response.go +++ b/api/datadogV2/model_incident_service_response.go @@ -111,22 +111,11 @@ func (o IncidentServiceResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentServiceResponseData `json:"data"` - }{} all := struct { - Data IncidentServiceResponseData `json:"data"` + Data *IncidentServiceResponseData `json:"data"` Included []IncidentServiceIncludedItems `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) @@ -147,7 +139,7 @@ func (o *IncidentServiceResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_service_response_attributes.go b/api/datadogV2/model_incident_service_response_attributes.go index 34efa2411b5..00fbafe0248 100644 --- a/api/datadogV2/model_incident_service_response_attributes.go +++ b/api/datadogV2/model_incident_service_response_attributes.go @@ -163,8 +163,7 @@ func (o *IncidentServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err err Modified *time.Time `json:"modified,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_service_response_data.go b/api/datadogV2/model_incident_service_response_data.go index cc3cca7fd3b..fd8f0b4901b 100644 --- a/api/datadogV2/model_incident_service_response_data.go +++ b/api/datadogV2/model_incident_service_response_data.go @@ -173,28 +173,13 @@ func (o IncidentServiceResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentServiceType `json:"type"` - }{} all := struct { Attributes *IncidentServiceResponseAttributes `json:"attributes,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type IncidentServiceType `json:"type"` + Type *IncidentServiceType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +187,12 @@ func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -224,7 +215,7 @@ func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -233,7 +224,7 @@ func (o *IncidentServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_service_update_attributes.go b/api/datadogV2/model_incident_service_update_attributes.go index ab2a9edde9e..3730800727a 100644 --- a/api/datadogV2/model_incident_service_update_attributes.go +++ b/api/datadogV2/model_incident_service_update_attributes.go @@ -78,21 +78,10 @@ func (o IncidentServiceUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *IncidentServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_service_update_data.go b/api/datadogV2/model_incident_service_update_data.go index e56440735d2..d923b77a12f 100644 --- a/api/datadogV2/model_incident_service_update_data.go +++ b/api/datadogV2/model_incident_service_update_data.go @@ -179,24 +179,13 @@ func (o IncidentServiceUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IncidentServiceType `json:"type"` - }{} all := struct { Attributes *IncidentServiceUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Relationships *IncidentServiceRelationships `json:"relationships,omitempty"` - Type IncidentServiceType `json:"type"` + Type *IncidentServiceType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -204,6 +193,9 @@ func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -235,7 +227,7 @@ func (o *IncidentServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_service_update_request.go b/api/datadogV2/model_incident_service_update_request.go index 33037b1b56d..035ed45daf1 100644 --- a/api/datadogV2/model_incident_service_update_request.go +++ b/api/datadogV2/model_incident_service_update_request.go @@ -78,21 +78,10 @@ func (o IncidentServiceUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentServiceUpdateData `json:"data"` - }{} all := struct { - Data IncidentServiceUpdateData `json:"data"` + Data *IncidentServiceUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_services_response.go b/api/datadogV2/model_incident_services_response.go index f1d7c8d7767..8d272c4a035 100644 --- a/api/datadogV2/model_incident_services_response.go +++ b/api/datadogV2/model_incident_services_response.go @@ -144,23 +144,12 @@ func (o IncidentServicesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentServiceResponseData `json:"data"` - }{} all := struct { - Data []IncidentServiceResponseData `json:"data"` + Data *[]IncidentServiceResponseData `json:"data"` Included []IncidentServiceIncludedItems `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *IncidentServicesResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_incident_team_create_attributes.go b/api/datadogV2/model_incident_team_create_attributes.go index 403a1e7a470..76928580889 100644 --- a/api/datadogV2/model_incident_team_create_attributes.go +++ b/api/datadogV2/model_incident_team_create_attributes.go @@ -78,21 +78,10 @@ func (o IncidentTeamCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *IncidentTeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_team_create_data.go b/api/datadogV2/model_incident_team_create_data.go index 94d58ad9e0d..95f6615847d 100644 --- a/api/datadogV2/model_incident_team_create_data.go +++ b/api/datadogV2/model_incident_team_create_data.go @@ -146,23 +146,12 @@ func (o IncidentTeamCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IncidentTeamType `json:"type"` - }{} all := struct { Attributes *IncidentTeamCreateAttributes `json:"attributes,omitempty"` Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - Type IncidentTeamType `json:"type"` + Type *IncidentTeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -200,7 +192,7 @@ func (o *IncidentTeamCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_team_create_request.go b/api/datadogV2/model_incident_team_create_request.go index ce25045d733..2e62f8418ed 100644 --- a/api/datadogV2/model_incident_team_create_request.go +++ b/api/datadogV2/model_incident_team_create_request.go @@ -78,21 +78,10 @@ func (o IncidentTeamCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentTeamCreateData `json:"data"` - }{} all := struct { - Data IncidentTeamCreateData `json:"data"` + Data *IncidentTeamCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentTeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_team_relationships.go b/api/datadogV2/model_incident_team_relationships.go index ed2abe29f65..de6060111ad 100644 --- a/api/datadogV2/model_incident_team_relationships.go +++ b/api/datadogV2/model_incident_team_relationships.go @@ -120,8 +120,7 @@ func (o *IncidentTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { CreatedBy *RelationshipToUser `json:"created_by,omitempty"` LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_team_response.go b/api/datadogV2/model_incident_team_response.go index 6b88e1b434b..a6d279c2368 100644 --- a/api/datadogV2/model_incident_team_response.go +++ b/api/datadogV2/model_incident_team_response.go @@ -111,22 +111,11 @@ func (o IncidentTeamResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentTeamResponseData `json:"data"` - }{} all := struct { - Data IncidentTeamResponseData `json:"data"` + Data *IncidentTeamResponseData `json:"data"` Included []IncidentTeamIncludedItems `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) @@ -147,7 +139,7 @@ func (o *IncidentTeamResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_team_response_attributes.go b/api/datadogV2/model_incident_team_response_attributes.go index a29c48d6b16..1810df2596c 100644 --- a/api/datadogV2/model_incident_team_response_attributes.go +++ b/api/datadogV2/model_incident_team_response_attributes.go @@ -163,8 +163,7 @@ func (o *IncidentTeamResponseAttributes) UnmarshalJSON(bytes []byte) (err error) Modified *time.Time `json:"modified,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_team_response_data.go b/api/datadogV2/model_incident_team_response_data.go index d91a47766ff..da87f4b8791 100644 --- a/api/datadogV2/model_incident_team_response_data.go +++ b/api/datadogV2/model_incident_team_response_data.go @@ -192,8 +192,7 @@ func (o *IncidentTeamResponseData) UnmarshalJSON(bytes []byte) (err error) { Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` Type *IncidentTeamType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_team_update_attributes.go b/api/datadogV2/model_incident_team_update_attributes.go index 1d1c2c91fa7..30603ca5058 100644 --- a/api/datadogV2/model_incident_team_update_attributes.go +++ b/api/datadogV2/model_incident_team_update_attributes.go @@ -78,21 +78,10 @@ func (o IncidentTeamUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *IncidentTeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_team_update_data.go b/api/datadogV2/model_incident_team_update_data.go index a7285335c39..a41f154bac7 100644 --- a/api/datadogV2/model_incident_team_update_data.go +++ b/api/datadogV2/model_incident_team_update_data.go @@ -179,24 +179,13 @@ func (o IncidentTeamUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IncidentTeamType `json:"type"` - }{} all := struct { Attributes *IncidentTeamUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Relationships *IncidentTeamRelationships `json:"relationships,omitempty"` - Type IncidentTeamType `json:"type"` + Type *IncidentTeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -204,6 +193,9 @@ func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -235,7 +227,7 @@ func (o *IncidentTeamUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_team_update_request.go b/api/datadogV2/model_incident_team_update_request.go index 2b7d19714cc..ed46b1ddaa7 100644 --- a/api/datadogV2/model_incident_team_update_request.go +++ b/api/datadogV2/model_incident_team_update_request.go @@ -78,21 +78,10 @@ func (o IncidentTeamUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentTeamUpdateData `json:"data"` - }{} all := struct { - Data IncidentTeamUpdateData `json:"data"` + Data *IncidentTeamUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_teams_response.go b/api/datadogV2/model_incident_teams_response.go index 1213e1f5868..b053e9a5d3b 100644 --- a/api/datadogV2/model_incident_teams_response.go +++ b/api/datadogV2/model_incident_teams_response.go @@ -144,23 +144,12 @@ func (o IncidentTeamsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentTeamResponseData `json:"data"` - }{} all := struct { - Data []IncidentTeamResponseData `json:"data"` + Data *[]IncidentTeamResponseData `json:"data"` Included []IncidentTeamIncludedItems `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *IncidentTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go b/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go index 98b3bb14972..bce788df8da 100644 --- a/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go +++ b/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes.go @@ -144,27 +144,12 @@ func (o IncidentTimelineCellMarkdownCreateAttributes) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - CellType *IncidentTimelineCellMarkdownContentType `json:"cell_type"` - Content *IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` - }{} all := struct { - CellType IncidentTimelineCellMarkdownContentType `json:"cell_type"` - Content IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` - Important *bool `json:"important,omitempty"` + CellType *IncidentTimelineCellMarkdownContentType `json:"cell_type"` + Content *IncidentTimelineCellMarkdownCreateAttributesContent `json:"content"` + Important *bool `json:"important,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.CellType == nil { - return fmt.Errorf("required field cell_type missing") - } - if required.Content == nil { - return fmt.Errorf("required field content missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -172,6 +157,12 @@ func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byt o.UnparsedObject = raw return nil } + if all.CellType == nil { + return fmt.Errorf("required field cell_type missing") + } + if all.Content == nil { + return fmt.Errorf("required field content missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"cell_type", "content", "important"}) @@ -186,7 +177,7 @@ func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byt o.UnparsedObject = raw return nil } - o.CellType = all.CellType + o.CellType = *all.CellType if all.Content.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -194,7 +185,7 @@ func (o *IncidentTimelineCellMarkdownCreateAttributes) UnmarshalJSON(bytes []byt } o.UnparsedObject = raw } - o.Content = all.Content + o.Content = *all.Content o.Important = all.Important if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go b/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go index 4617b115839..cfa61d57861 100644 --- a/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go +++ b/api/datadogV2/model_incident_timeline_cell_markdown_create_attributes_content.go @@ -86,8 +86,7 @@ func (o *IncidentTimelineCellMarkdownCreateAttributesContent) UnmarshalJSON(byte all := struct { Content *string `json:"content,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_todo_anonymous_assignee.go b/api/datadogV2/model_incident_todo_anonymous_assignee.go index be1fda29593..4a295966b41 100644 --- a/api/datadogV2/model_incident_todo_anonymous_assignee.go +++ b/api/datadogV2/model_incident_todo_anonymous_assignee.go @@ -161,43 +161,32 @@ func (o IncidentTodoAnonymousAssignee) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoAnonymousAssignee) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Icon *string `json:"icon"` Id *string `json:"id"` Name *string `json:"name"` Source *IncidentTodoAnonymousAssigneeSource `json:"source"` }{} - all := struct { - Icon string `json:"icon"` - Id string `json:"id"` - Name string `json:"name"` - Source IncidentTodoAnonymousAssigneeSource `json:"source"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Icon == nil { + if all.Icon == nil { return fmt.Errorf("required field icon missing") } - if required.Id == nil { + if all.Id == nil { return fmt.Errorf("required field id missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Source == nil { + if all.Source == nil { return fmt.Errorf("required field source missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"icon", "id", "name", "source"}) @@ -212,10 +201,10 @@ func (o *IncidentTodoAnonymousAssignee) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Icon = all.Icon - o.Id = all.Id - o.Name = all.Name - o.Source = all.Source + o.Icon = *all.Icon + o.Id = *all.Id + o.Name = *all.Name + o.Source = *all.Source if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_todo_attributes.go b/api/datadogV2/model_incident_todo_attributes.go index f219b15a817..da1e6fadee2 100644 --- a/api/datadogV2/model_incident_todo_attributes.go +++ b/api/datadogV2/model_incident_todo_attributes.go @@ -226,29 +226,14 @@ func (o IncidentTodoAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Assignees *[]IncidentTodoAssignee `json:"assignees"` - Content *string `json:"content"` - }{} all := struct { - Assignees []IncidentTodoAssignee `json:"assignees"` - Completed datadog.NullableString `json:"completed,omitempty"` - Content string `json:"content"` - DueDate datadog.NullableString `json:"due_date,omitempty"` - IncidentId *string `json:"incident_id,omitempty"` + Assignees *[]IncidentTodoAssignee `json:"assignees"` + Completed datadog.NullableString `json:"completed,omitempty"` + Content *string `json:"content"` + DueDate datadog.NullableString `json:"due_date,omitempty"` + IncidentId *string `json:"incident_id,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignees == nil { - return fmt.Errorf("required field assignees missing") - } - if required.Content == nil { - return fmt.Errorf("required field content missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -256,15 +241,21 @@ func (o *IncidentTodoAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Assignees == nil { + return fmt.Errorf("required field assignees missing") + } + if all.Content == nil { + return fmt.Errorf("required field content missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"assignees", "completed", "content", "due_date", "incident_id"}) } else { return err } - o.Assignees = all.Assignees + o.Assignees = *all.Assignees o.Completed = all.Completed - o.Content = all.Content + o.Content = *all.Content o.DueDate = all.DueDate o.IncidentId = all.IncidentId if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_incident_todo_create_data.go b/api/datadogV2/model_incident_todo_create_data.go index 265bee69b4c..fb4d8a6dc12 100644 --- a/api/datadogV2/model_incident_todo_create_data.go +++ b/api/datadogV2/model_incident_todo_create_data.go @@ -107,26 +107,11 @@ func (o IncidentTodoCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *IncidentTodoAttributes `json:"attributes"` Type *IncidentTodoType `json:"type"` }{} - all := struct { - Attributes IncidentTodoAttributes `json:"attributes"` - Type IncidentTodoType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IncidentTodoCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *IncidentTodoCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_todo_create_request.go b/api/datadogV2/model_incident_todo_create_request.go index c4602a49600..892cc5ffd4c 100644 --- a/api/datadogV2/model_incident_todo_create_request.go +++ b/api/datadogV2/model_incident_todo_create_request.go @@ -78,21 +78,10 @@ func (o IncidentTodoCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentTodoCreateData `json:"data"` - }{} all := struct { - Data IncidentTodoCreateData `json:"data"` + Data *IncidentTodoCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentTodoCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentTodoCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_todo_list_response.go b/api/datadogV2/model_incident_todo_list_response.go index d4df43bd69e..7c4cfa0b1a0 100644 --- a/api/datadogV2/model_incident_todo_list_response.go +++ b/api/datadogV2/model_incident_todo_list_response.go @@ -144,23 +144,12 @@ func (o IncidentTodoListResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoListResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentTodoResponseData `json:"data"` - }{} all := struct { - Data []IncidentTodoResponseData `json:"data"` + Data *[]IncidentTodoResponseData `json:"data"` Included []IncidentTodoResponseIncludedItem `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *IncidentTodoListResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_incident_todo_patch_data.go b/api/datadogV2/model_incident_todo_patch_data.go index 7fe9d159bf8..0a50ed5c3fb 100644 --- a/api/datadogV2/model_incident_todo_patch_data.go +++ b/api/datadogV2/model_incident_todo_patch_data.go @@ -107,26 +107,11 @@ func (o IncidentTodoPatchData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoPatchData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *IncidentTodoAttributes `json:"attributes"` Type *IncidentTodoType `json:"type"` }{} - all := struct { - Attributes IncidentTodoAttributes `json:"attributes"` - Type IncidentTodoType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *IncidentTodoPatchData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *IncidentTodoPatchData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_todo_patch_request.go b/api/datadogV2/model_incident_todo_patch_request.go index a3f33765fc8..ce5bfca9619 100644 --- a/api/datadogV2/model_incident_todo_patch_request.go +++ b/api/datadogV2/model_incident_todo_patch_request.go @@ -78,21 +78,10 @@ func (o IncidentTodoPatchRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoPatchRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentTodoPatchData `json:"data"` - }{} all := struct { - Data IncidentTodoPatchData `json:"data"` + Data *IncidentTodoPatchData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentTodoPatchRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentTodoPatchRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_todo_response.go b/api/datadogV2/model_incident_todo_response.go index 79d8cc83cf7..d5fe9c5dc2f 100644 --- a/api/datadogV2/model_incident_todo_response.go +++ b/api/datadogV2/model_incident_todo_response.go @@ -111,22 +111,11 @@ func (o IncidentTodoResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentTodoResponseData `json:"data"` - }{} all := struct { - Data IncidentTodoResponseData `json:"data"` + Data *IncidentTodoResponseData `json:"data"` Included []IncidentTodoResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *IncidentTodoResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) @@ -147,7 +139,7 @@ func (o *IncidentTodoResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_todo_response_data.go b/api/datadogV2/model_incident_todo_response_data.go index efd9fec725c..dcce359a7bf 100644 --- a/api/datadogV2/model_incident_todo_response_data.go +++ b/api/datadogV2/model_incident_todo_response_data.go @@ -140,27 +140,12 @@ func (o IncidentTodoResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentTodoResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentTodoType `json:"type"` - }{} all := struct { Attributes *IncidentTodoAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type IncidentTodoType `json:"type"` + Id *string `json:"id"` + Type *IncidentTodoType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *IncidentTodoResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *IncidentTodoResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_update_attributes.go b/api/datadogV2/model_incident_update_attributes.go index 31add54b4ec..bf906eb8e78 100644 --- a/api/datadogV2/model_incident_update_attributes.go +++ b/api/datadogV2/model_incident_update_attributes.go @@ -358,8 +358,7 @@ func (o *IncidentUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { NotificationHandles []IncidentNotificationHandle `json:"notification_handles,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_update_data.go b/api/datadogV2/model_incident_update_data.go index 513f3a0b9fd..2fd3f7727a9 100644 --- a/api/datadogV2/model_incident_update_data.go +++ b/api/datadogV2/model_incident_update_data.go @@ -173,28 +173,13 @@ func (o IncidentUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *IncidentType `json:"type"` - }{} all := struct { Attributes *IncidentUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` Relationships *IncidentUpdateRelationships `json:"relationships,omitempty"` - Type IncidentType `json:"type"` + Type *IncidentType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +187,12 @@ func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -224,7 +215,7 @@ func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -233,7 +224,7 @@ func (o *IncidentUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incident_update_relationships.go b/api/datadogV2/model_incident_update_relationships.go index ddb3d5330fb..be9f8dd65c0 100644 --- a/api/datadogV2/model_incident_update_relationships.go +++ b/api/datadogV2/model_incident_update_relationships.go @@ -154,8 +154,7 @@ func (o *IncidentUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { Integrations *RelationshipToIncidentIntegrationMetadatas `json:"integrations,omitempty"` Postmortem *RelationshipToIncidentPostmortem `json:"postmortem,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_incident_update_request.go b/api/datadogV2/model_incident_update_request.go index ddf5f565ef5..57ef84a494e 100644 --- a/api/datadogV2/model_incident_update_request.go +++ b/api/datadogV2/model_incident_update_request.go @@ -78,21 +78,10 @@ func (o IncidentUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IncidentUpdateData `json:"data"` - }{} all := struct { - Data IncidentUpdateData `json:"data"` + Data *IncidentUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IncidentUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_incidents_response.go b/api/datadogV2/model_incidents_response.go index 37097ba8047..cbd500039ba 100644 --- a/api/datadogV2/model_incidents_response.go +++ b/api/datadogV2/model_incidents_response.go @@ -144,23 +144,12 @@ func (o IncidentsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IncidentsResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]IncidentResponseData `json:"data"` - }{} all := struct { - Data []IncidentResponseData `json:"data"` + Data *[]IncidentResponseData `json:"data"` Included []IncidentResponseIncludedItem `json:"included,omitempty"` Meta *IncidentResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *IncidentsResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data o.Included = all.Included if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_intake_payload_accepted.go b/api/datadogV2/model_intake_payload_accepted.go index 65641695f36..a40a64ab3dc 100644 --- a/api/datadogV2/model_intake_payload_accepted.go +++ b/api/datadogV2/model_intake_payload_accepted.go @@ -86,8 +86,7 @@ func (o *IntakePayloadAccepted) UnmarshalJSON(bytes []byte) (err error) { all := struct { Errors []string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ip_allowlist_attributes.go b/api/datadogV2/model_ip_allowlist_attributes.go index dfb3a2acf63..dc6efc339c7 100644 --- a/api/datadogV2/model_ip_allowlist_attributes.go +++ b/api/datadogV2/model_ip_allowlist_attributes.go @@ -120,8 +120,7 @@ func (o *IPAllowlistAttributes) UnmarshalJSON(bytes []byte) (err error) { Enabled *bool `json:"enabled,omitempty"` Entries []IPAllowlistEntry `json:"entries,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ip_allowlist_data.go b/api/datadogV2/model_ip_allowlist_data.go index ba439e512df..15ac663c651 100644 --- a/api/datadogV2/model_ip_allowlist_data.go +++ b/api/datadogV2/model_ip_allowlist_data.go @@ -146,23 +146,12 @@ func (o IPAllowlistData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IPAllowlistType `json:"type"` - }{} all := struct { Attributes *IPAllowlistAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` - Type IPAllowlistType `json:"type"` + Type *IPAllowlistType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *IPAllowlistData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -193,7 +185,7 @@ func (o *IPAllowlistData) UnmarshalJSON(bytes []byte) (err error) { } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ip_allowlist_entry.go b/api/datadogV2/model_ip_allowlist_entry.go index 76795e9b637..05812e1e15a 100644 --- a/api/datadogV2/model_ip_allowlist_entry.go +++ b/api/datadogV2/model_ip_allowlist_entry.go @@ -78,21 +78,10 @@ func (o IPAllowlistEntry) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistEntry) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IPAllowlistEntryData `json:"data"` - }{} all := struct { - Data IPAllowlistEntryData `json:"data"` + Data *IPAllowlistEntryData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IPAllowlistEntry) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IPAllowlistEntry) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ip_allowlist_entry_attributes.go b/api/datadogV2/model_ip_allowlist_entry_attributes.go index 0aa18da7c9b..84f2a60477f 100644 --- a/api/datadogV2/model_ip_allowlist_entry_attributes.go +++ b/api/datadogV2/model_ip_allowlist_entry_attributes.go @@ -197,8 +197,7 @@ func (o *IPAllowlistEntryAttributes) UnmarshalJSON(bytes []byte) (err error) { ModifiedAt *time.Time `json:"modified_at,omitempty"` Note *string `json:"note,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ip_allowlist_entry_data.go b/api/datadogV2/model_ip_allowlist_entry_data.go index d8674bcf0d2..b30c21657c0 100644 --- a/api/datadogV2/model_ip_allowlist_entry_data.go +++ b/api/datadogV2/model_ip_allowlist_entry_data.go @@ -146,23 +146,12 @@ func (o IPAllowlistEntryData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistEntryData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *IPAllowlistEntryType `json:"type"` - }{} all := struct { Attributes *IPAllowlistEntryAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` - Type IPAllowlistEntryType `json:"type"` + Type *IPAllowlistEntryType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *IPAllowlistEntryData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -193,7 +185,7 @@ func (o *IPAllowlistEntryData) UnmarshalJSON(bytes []byte) (err error) { } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ip_allowlist_response.go b/api/datadogV2/model_ip_allowlist_response.go index b29ebecac0a..3c92b8721ac 100644 --- a/api/datadogV2/model_ip_allowlist_response.go +++ b/api/datadogV2/model_ip_allowlist_response.go @@ -86,8 +86,7 @@ func (o *IPAllowlistResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *IPAllowlistData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_ip_allowlist_update_request.go b/api/datadogV2/model_ip_allowlist_update_request.go index 82f7fc70ddc..1d29cd7bf39 100644 --- a/api/datadogV2/model_ip_allowlist_update_request.go +++ b/api/datadogV2/model_ip_allowlist_update_request.go @@ -78,21 +78,10 @@ func (o IPAllowlistUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *IPAllowlistUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *IPAllowlistData `json:"data"` - }{} all := struct { - Data IPAllowlistData `json:"data"` + Data *IPAllowlistData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *IPAllowlistUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *IPAllowlistUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_jira_integration_metadata.go b/api/datadogV2/model_jira_integration_metadata.go index 48d52a600d5..9b18164ecb2 100644 --- a/api/datadogV2/model_jira_integration_metadata.go +++ b/api/datadogV2/model_jira_integration_metadata.go @@ -78,21 +78,10 @@ func (o JiraIntegrationMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JiraIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Issues *[]JiraIntegrationMetadataIssuesItem `json:"issues"` - }{} all := struct { - Issues []JiraIntegrationMetadataIssuesItem `json:"issues"` + Issues *[]JiraIntegrationMetadataIssuesItem `json:"issues"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Issues == nil { - return fmt.Errorf("required field issues missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *JiraIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Issues == nil { + return fmt.Errorf("required field issues missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"issues"}) } else { return err } - o.Issues = all.Issues + o.Issues = *all.Issues if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_jira_integration_metadata_issues_item.go b/api/datadogV2/model_jira_integration_metadata_issues_item.go index 389f9de8744..538a4ccd302 100644 --- a/api/datadogV2/model_jira_integration_metadata_issues_item.go +++ b/api/datadogV2/model_jira_integration_metadata_issues_item.go @@ -204,29 +204,14 @@ func (o JiraIntegrationMetadataIssuesItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JiraIntegrationMetadataIssuesItem) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Account *string `json:"account"` - ProjectKey *string `json:"project_key"` - }{} all := struct { - Account string `json:"account"` + Account *string `json:"account"` IssueKey *string `json:"issue_key,omitempty"` IssuetypeId *string `json:"issuetype_id,omitempty"` - ProjectKey string `json:"project_key"` + ProjectKey *string `json:"project_key"` RedirectUrl *string `json:"redirect_url,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Account == nil { - return fmt.Errorf("required field account missing") - } - if required.ProjectKey == nil { - return fmt.Errorf("required field project_key missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -234,16 +219,22 @@ func (o *JiraIntegrationMetadataIssuesItem) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.Account == nil { + return fmt.Errorf("required field account missing") + } + if all.ProjectKey == nil { + return fmt.Errorf("required field project_key missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"account", "issue_key", "issuetype_id", "project_key", "redirect_url"}) } else { return err } - o.Account = all.Account + o.Account = *all.Account o.IssueKey = all.IssueKey o.IssuetypeId = all.IssuetypeId - o.ProjectKey = all.ProjectKey + o.ProjectKey = *all.ProjectKey o.RedirectUrl = all.RedirectUrl if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_jsonapi_error_item.go b/api/datadogV2/model_jsonapi_error_item.go index 4dabfd82747..31ef3c443c2 100644 --- a/api/datadogV2/model_jsonapi_error_item.go +++ b/api/datadogV2/model_jsonapi_error_item.go @@ -154,8 +154,7 @@ func (o *JSONAPIErrorItem) UnmarshalJSON(bytes []byte) (err error) { Status *string `json:"status,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_jsonapi_error_response.go b/api/datadogV2/model_jsonapi_error_response.go index 45a6a8b0472..6f3773a1965 100644 --- a/api/datadogV2/model_jsonapi_error_response.go +++ b/api/datadogV2/model_jsonapi_error_response.go @@ -78,21 +78,10 @@ func (o JSONAPIErrorResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *JSONAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Errors *[]JSONAPIErrorItem `json:"errors"` - }{} all := struct { - Errors []JSONAPIErrorItem `json:"errors"` + Errors *[]JSONAPIErrorItem `json:"errors"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Errors == nil { - return fmt.Errorf("required field errors missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *JSONAPIErrorResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Errors == nil { + return fmt.Errorf("required field errors missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"errors"}) } else { return err } - o.Errors = all.Errors + o.Errors = *all.Errors if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_list_application_keys_response.go b/api/datadogV2/model_list_application_keys_response.go index 0de228d892b..3da87224699 100644 --- a/api/datadogV2/model_list_application_keys_response.go +++ b/api/datadogV2/model_list_application_keys_response.go @@ -120,8 +120,7 @@ func (o *ListApplicationKeysResponse) UnmarshalJSON(bytes []byte) (err error) { Data []PartialApplicationKey `json:"data,omitempty"` Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_list_findings_meta.go b/api/datadogV2/model_list_findings_meta.go index 279643c26c6..9ae9cf4b27c 100644 --- a/api/datadogV2/model_list_findings_meta.go +++ b/api/datadogV2/model_list_findings_meta.go @@ -113,8 +113,7 @@ func (o *ListFindingsMeta) UnmarshalJSON(bytes []byte) (err error) { Page *ListFindingsPage `json:"page,omitempty"` SnapshotTimestamp *int64 `json:"snapshot_timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_list_findings_page.go b/api/datadogV2/model_list_findings_page.go index e91eb5e7e88..5ba0c8616dc 100644 --- a/api/datadogV2/model_list_findings_page.go +++ b/api/datadogV2/model_list_findings_page.go @@ -113,8 +113,7 @@ func (o *ListFindingsPage) UnmarshalJSON(bytes []byte) (err error) { Cursor *string `json:"cursor,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_list_findings_response.go b/api/datadogV2/model_list_findings_response.go index b7e3c489a7b..b2a1640595a 100644 --- a/api/datadogV2/model_list_findings_response.go +++ b/api/datadogV2/model_list_findings_response.go @@ -105,26 +105,11 @@ func (o ListFindingsResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ListFindingsResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Data *[]Finding `json:"data"` Meta *ListFindingsMeta `json:"meta"` }{} - all := struct { - Data []Finding `json:"data"` - Meta ListFindingsMeta `json:"meta"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,13 +117,19 @@ func (o *ListFindingsResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -146,7 +137,7 @@ func (o *ListFindingsResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_log.go b/api/datadogV2/model_log.go index 2eb6c4d782c..1c4cfa018c6 100644 --- a/api/datadogV2/model_log.go +++ b/api/datadogV2/model_log.go @@ -158,8 +158,7 @@ func (o *Log) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *LogType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_log_attributes.go b/api/datadogV2/model_log_attributes.go index 02aad89bf6b..eaea0ef607e 100644 --- a/api/datadogV2/model_log_attributes.go +++ b/api/datadogV2/model_log_attributes.go @@ -299,8 +299,7 @@ func (o *LogAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_bucket.go b/api/datadogV2/model_logs_aggregate_bucket.go index 956a7974589..867af1538f2 100644 --- a/api/datadogV2/model_logs_aggregate_bucket.go +++ b/api/datadogV2/model_logs_aggregate_bucket.go @@ -120,8 +120,7 @@ func (o *LogsAggregateBucket) UnmarshalJSON(bytes []byte) (err error) { By map[string]interface{} `json:"by,omitempty"` Computes map[string]LogsAggregateBucketValue `json:"computes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go b/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go index 32e12c7f2c0..0e647be9e3b 100644 --- a/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go +++ b/api/datadogV2/model_logs_aggregate_bucket_value_timeseries_point.go @@ -120,8 +120,7 @@ func (o *LogsAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (e Time *string `json:"time,omitempty"` Value *float64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_request.go b/api/datadogV2/model_logs_aggregate_request.go index 0441beac0be..a3754287dbc 100644 --- a/api/datadogV2/model_logs_aggregate_request.go +++ b/api/datadogV2/model_logs_aggregate_request.go @@ -223,8 +223,7 @@ func (o *LogsAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { Options *LogsQueryOptions `json:"options,omitempty"` Page *LogsAggregateRequestPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_request_page.go b/api/datadogV2/model_logs_aggregate_request_page.go index 96204ad1084..09cc45cbf2a 100644 --- a/api/datadogV2/model_logs_aggregate_request_page.go +++ b/api/datadogV2/model_logs_aggregate_request_page.go @@ -86,8 +86,7 @@ func (o *LogsAggregateRequestPage) UnmarshalJSON(bytes []byte) (err error) { all := struct { Cursor *string `json:"cursor,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_response.go b/api/datadogV2/model_logs_aggregate_response.go index fab39eb4570..6951da7039e 100644 --- a/api/datadogV2/model_logs_aggregate_response.go +++ b/api/datadogV2/model_logs_aggregate_response.go @@ -120,8 +120,7 @@ func (o *LogsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) { Data *LogsAggregateResponseData `json:"data,omitempty"` Meta *LogsResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_response_data.go b/api/datadogV2/model_logs_aggregate_response_data.go index 2d0dcb79b90..44bce2bd95d 100644 --- a/api/datadogV2/model_logs_aggregate_response_data.go +++ b/api/datadogV2/model_logs_aggregate_response_data.go @@ -86,8 +86,7 @@ func (o *LogsAggregateResponseData) UnmarshalJSON(bytes []byte) (err error) { all := struct { Buckets []LogsAggregateBucket `json:"buckets,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_aggregate_sort.go b/api/datadogV2/model_logs_aggregate_sort.go index 23d4964b213..70f9d59863d 100644 --- a/api/datadogV2/model_logs_aggregate_sort.go +++ b/api/datadogV2/model_logs_aggregate_sort.go @@ -192,8 +192,7 @@ func (o *LogsAggregateSort) UnmarshalJSON(bytes []byte) (err error) { Order *LogsSortOrder `json:"order,omitempty"` Type *LogsAggregateSortType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_archive.go b/api/datadogV2/model_logs_archive.go index 73933a317e0..5359a68a311 100644 --- a/api/datadogV2/model_logs_archive.go +++ b/api/datadogV2/model_logs_archive.go @@ -86,8 +86,7 @@ func (o *LogsArchive) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *LogsArchiveDefinition `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_archive_attributes.go b/api/datadogV2/model_logs_archive_attributes.go index 56bc027f5b2..2888f04298b 100644 --- a/api/datadogV2/model_logs_archive_attributes.go +++ b/api/datadogV2/model_logs_archive_attributes.go @@ -282,35 +282,16 @@ func (o LogsArchiveAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Destination NullableLogsArchiveDestination `json:"destination"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} all := struct { Destination NullableLogsArchiveDestination `json:"destination"` IncludeTags *bool `json:"include_tags,omitempty"` - Name string `json:"name"` - Query string `json:"query"` + Name *string `json:"name"` + Query *string `json:"query"` RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` RehydrationTags []string `json:"rehydration_tags,omitempty"` State *LogsArchiveState `json:"state,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if !required.Destination.IsSet() { - return fmt.Errorf("required field destination missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -318,6 +299,15 @@ func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if !all.Destination.IsSet() { + return fmt.Errorf("required field destination missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags", "state"}) @@ -334,8 +324,8 @@ func (o *LogsArchiveAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.Destination = all.Destination o.IncludeTags = all.IncludeTags - o.Name = all.Name - o.Query = all.Query + o.Name = *all.Name + o.Query = *all.Query o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb o.RehydrationTags = all.RehydrationTags o.State = all.State diff --git a/api/datadogV2/model_logs_archive_create_request.go b/api/datadogV2/model_logs_archive_create_request.go index 03cfead5b48..8f4eed7c800 100644 --- a/api/datadogV2/model_logs_archive_create_request.go +++ b/api/datadogV2/model_logs_archive_create_request.go @@ -86,8 +86,7 @@ func (o *LogsArchiveCreateRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *LogsArchiveCreateRequestDefinition `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_archive_create_request_attributes.go b/api/datadogV2/model_logs_archive_create_request_attributes.go index c7eeb4357b2..df332cfd234 100644 --- a/api/datadogV2/model_logs_archive_create_request_attributes.go +++ b/api/datadogV2/model_logs_archive_create_request_attributes.go @@ -247,34 +247,15 @@ func (o LogsArchiveCreateRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Destination *LogsArchiveCreateRequestDestination `json:"destination"` - Name *string `json:"name"` - Query *string `json:"query"` - }{} all := struct { - Destination LogsArchiveCreateRequestDestination `json:"destination"` - IncludeTags *bool `json:"include_tags,omitempty"` - Name string `json:"name"` - Query string `json:"query"` - RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` - RehydrationTags []string `json:"rehydration_tags,omitempty"` + Destination *LogsArchiveCreateRequestDestination `json:"destination"` + IncludeTags *bool `json:"include_tags,omitempty"` + Name *string `json:"name"` + Query *string `json:"query"` + RehydrationMaxScanSizeInGb datadog.NullableInt64 `json:"rehydration_max_scan_size_in_gb,omitempty"` + RehydrationTags []string `json:"rehydration_tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Destination == nil { - return fmt.Errorf("required field destination missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -282,16 +263,25 @@ func (o *LogsArchiveCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.Destination == nil { + return fmt.Errorf("required field destination missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"destination", "include_tags", "name", "query", "rehydration_max_scan_size_in_gb", "rehydration_tags"}) } else { return err } - o.Destination = all.Destination + o.Destination = *all.Destination o.IncludeTags = all.IncludeTags - o.Name = all.Name - o.Query = all.Query + o.Name = *all.Name + o.Query = *all.Query o.RehydrationMaxScanSizeInGb = all.RehydrationMaxScanSizeInGb o.RehydrationTags = all.RehydrationTags if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_logs_archive_create_request_definition.go b/api/datadogV2/model_logs_archive_create_request_definition.go index 39ee64dcb3a..50528721034 100644 --- a/api/datadogV2/model_logs_archive_create_request_definition.go +++ b/api/datadogV2/model_logs_archive_create_request_definition.go @@ -113,22 +113,11 @@ func (o LogsArchiveCreateRequestDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *string `json:"type"` - }{} all := struct { Attributes *LogsArchiveCreateRequestAttributes `json:"attributes,omitempty"` - Type string `json:"type"` + Type *string `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -136,6 +125,9 @@ func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -150,7 +142,7 @@ func (o *LogsArchiveCreateRequestDefinition) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_definition.go b/api/datadogV2/model_logs_archive_definition.go index 3205be227ed..31c8cd2149c 100644 --- a/api/datadogV2/model_logs_archive_definition.go +++ b/api/datadogV2/model_logs_archive_definition.go @@ -144,23 +144,12 @@ func (o LogsArchiveDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *string `json:"type"` - }{} all := struct { Attributes *LogsArchiveAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` - Type string `json:"type"` + Type *string `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -183,7 +175,7 @@ func (o *LogsArchiveDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_destination_azure.go b/api/datadogV2/model_logs_archive_destination_azure.go index 79f0ef86c04..78913175673 100644 --- a/api/datadogV2/model_logs_archive_destination_azure.go +++ b/api/datadogV2/model_logs_archive_destination_azure.go @@ -227,45 +227,34 @@ func (o LogsArchiveDestinationAzure) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Container *string `json:"container"` Integration *LogsArchiveIntegrationAzure `json:"integration"` + Path *string `json:"path,omitempty"` + Region *string `json:"region,omitempty"` StorageAccount *string `json:"storage_account"` Type *LogsArchiveDestinationAzureType `json:"type"` }{} - all := struct { - Container string `json:"container"` - Integration LogsArchiveIntegrationAzure `json:"integration"` - Path *string `json:"path,omitempty"` - Region *string `json:"region,omitempty"` - StorageAccount string `json:"storage_account"` - Type LogsArchiveDestinationAzureType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Container == nil { + if all.Container == nil { return fmt.Errorf("required field container missing") } - if required.Integration == nil { + if all.Integration == nil { return fmt.Errorf("required field integration missing") } - if required.StorageAccount == nil { + if all.StorageAccount == nil { return fmt.Errorf("required field storage_account missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"container", "integration", "path", "region", "storage_account", "type"}) @@ -280,7 +269,7 @@ func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Container = all.Container + o.Container = *all.Container if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -288,11 +277,11 @@ func (o *LogsArchiveDestinationAzure) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Integration = all.Integration + o.Integration = *all.Integration o.Path = all.Path o.Region = all.Region - o.StorageAccount = all.StorageAccount - o.Type = all.Type + o.StorageAccount = *all.StorageAccount + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_destination_gcs.go b/api/datadogV2/model_logs_archive_destination_gcs.go index e677d616e2c..8b0052ba8a2 100644 --- a/api/datadogV2/model_logs_archive_destination_gcs.go +++ b/api/datadogV2/model_logs_archive_destination_gcs.go @@ -167,32 +167,13 @@ func (o LogsArchiveDestinationGCS) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Bucket *string `json:"bucket"` Integration *LogsArchiveIntegrationGCS `json:"integration"` + Path *string `json:"path,omitempty"` Type *LogsArchiveDestinationGCSType `json:"type"` }{} - all := struct { - Bucket string `json:"bucket"` - Integration LogsArchiveIntegrationGCS `json:"integration"` - Path *string `json:"path,omitempty"` - Type LogsArchiveDestinationGCSType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Bucket == nil { - return fmt.Errorf("required field bucket missing") - } - if required.Integration == nil { - return fmt.Errorf("required field integration missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +181,15 @@ func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Bucket == nil { + return fmt.Errorf("required field bucket missing") + } + if all.Integration == nil { + return fmt.Errorf("required field integration missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"bucket", "integration", "path", "type"}) @@ -214,7 +204,7 @@ func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Bucket = all.Bucket + o.Bucket = *all.Bucket if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -222,9 +212,9 @@ func (o *LogsArchiveDestinationGCS) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Integration = all.Integration + o.Integration = *all.Integration o.Path = all.Path - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_destination_s3.go b/api/datadogV2/model_logs_archive_destination_s3.go index 5004192ae37..039c2660e5f 100644 --- a/api/datadogV2/model_logs_archive_destination_s3.go +++ b/api/datadogV2/model_logs_archive_destination_s3.go @@ -167,32 +167,13 @@ func (o LogsArchiveDestinationS3) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Bucket *string `json:"bucket"` Integration *LogsArchiveIntegrationS3 `json:"integration"` + Path *string `json:"path,omitempty"` Type *LogsArchiveDestinationS3Type `json:"type"` }{} - all := struct { - Bucket string `json:"bucket"` - Integration LogsArchiveIntegrationS3 `json:"integration"` - Path *string `json:"path,omitempty"` - Type LogsArchiveDestinationS3Type `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Bucket == nil { - return fmt.Errorf("required field bucket missing") - } - if required.Integration == nil { - return fmt.Errorf("required field integration missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +181,15 @@ func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Bucket == nil { + return fmt.Errorf("required field bucket missing") + } + if all.Integration == nil { + return fmt.Errorf("required field integration missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"bucket", "integration", "path", "type"}) @@ -214,7 +204,7 @@ func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Bucket = all.Bucket + o.Bucket = *all.Bucket if all.Integration.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -222,9 +212,9 @@ func (o *LogsArchiveDestinationS3) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Integration = all.Integration + o.Integration = *all.Integration o.Path = all.Path - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_integration_azure.go b/api/datadogV2/model_logs_archive_integration_azure.go index 3c0b7038ed7..a09b9cada02 100644 --- a/api/datadogV2/model_logs_archive_integration_azure.go +++ b/api/datadogV2/model_logs_archive_integration_azure.go @@ -105,26 +105,11 @@ func (o LogsArchiveIntegrationAzure) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveIntegrationAzure) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ClientId *string `json:"client_id"` TenantId *string `json:"tenant_id"` }{} - all := struct { - ClientId string `json:"client_id"` - TenantId string `json:"tenant_id"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ClientId == nil { - return fmt.Errorf("required field client_id missing") - } - if required.TenantId == nil { - return fmt.Errorf("required field tenant_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *LogsArchiveIntegrationAzure) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ClientId == nil { + return fmt.Errorf("required field client_id missing") + } + if all.TenantId == nil { + return fmt.Errorf("required field tenant_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"client_id", "tenant_id"}) } else { return err } - o.ClientId = all.ClientId - o.TenantId = all.TenantId + o.ClientId = *all.ClientId + o.TenantId = *all.TenantId if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_integration_gcs.go b/api/datadogV2/model_logs_archive_integration_gcs.go index a5c0826a9cd..a6f98893f36 100644 --- a/api/datadogV2/model_logs_archive_integration_gcs.go +++ b/api/datadogV2/model_logs_archive_integration_gcs.go @@ -105,26 +105,11 @@ func (o LogsArchiveIntegrationGCS) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveIntegrationGCS) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ClientEmail *string `json:"client_email"` ProjectId *string `json:"project_id"` }{} - all := struct { - ClientEmail string `json:"client_email"` - ProjectId string `json:"project_id"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ClientEmail == nil { - return fmt.Errorf("required field client_email missing") - } - if required.ProjectId == nil { - return fmt.Errorf("required field project_id missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *LogsArchiveIntegrationGCS) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ClientEmail == nil { + return fmt.Errorf("required field client_email missing") + } + if all.ProjectId == nil { + return fmt.Errorf("required field project_id missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"client_email", "project_id"}) } else { return err } - o.ClientEmail = all.ClientEmail - o.ProjectId = all.ProjectId + o.ClientEmail = *all.ClientEmail + o.ProjectId = *all.ProjectId if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_integration_s3.go b/api/datadogV2/model_logs_archive_integration_s3.go index d1d157ca442..db8935c1245 100644 --- a/api/datadogV2/model_logs_archive_integration_s3.go +++ b/api/datadogV2/model_logs_archive_integration_s3.go @@ -105,26 +105,11 @@ func (o LogsArchiveIntegrationS3) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveIntegrationS3) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { AccountId *string `json:"account_id"` RoleName *string `json:"role_name"` }{} - all := struct { - AccountId string `json:"account_id"` - RoleName string `json:"role_name"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AccountId == nil { - return fmt.Errorf("required field account_id missing") - } - if required.RoleName == nil { - return fmt.Errorf("required field role_name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *LogsArchiveIntegrationS3) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AccountId == nil { + return fmt.Errorf("required field account_id missing") + } + if all.RoleName == nil { + return fmt.Errorf("required field role_name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "role_name"}) } else { return err } - o.AccountId = all.AccountId - o.RoleName = all.RoleName + o.AccountId = *all.AccountId + o.RoleName = *all.RoleName if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_order.go b/api/datadogV2/model_logs_archive_order.go index 300145bf501..92441048024 100644 --- a/api/datadogV2/model_logs_archive_order.go +++ b/api/datadogV2/model_logs_archive_order.go @@ -86,8 +86,7 @@ func (o *LogsArchiveOrder) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *LogsArchiveOrderDefinition `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_archive_order_attributes.go b/api/datadogV2/model_logs_archive_order_attributes.go index bf655c3908e..82996c48acd 100644 --- a/api/datadogV2/model_logs_archive_order_attributes.go +++ b/api/datadogV2/model_logs_archive_order_attributes.go @@ -79,21 +79,10 @@ func (o LogsArchiveOrderAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveOrderAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ArchiveIds *[]string `json:"archive_ids"` - }{} all := struct { - ArchiveIds []string `json:"archive_ids"` + ArchiveIds *[]string `json:"archive_ids"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ArchiveIds == nil { - return fmt.Errorf("required field archive_ids missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -101,13 +90,16 @@ func (o *LogsArchiveOrderAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ArchiveIds == nil { + return fmt.Errorf("required field archive_ids missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"archive_ids"}) } else { return err } - o.ArchiveIds = all.ArchiveIds + o.ArchiveIds = *all.ArchiveIds if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archive_order_definition.go b/api/datadogV2/model_logs_archive_order_definition.go index 4a09565b8a1..2e36e6d2295 100644 --- a/api/datadogV2/model_logs_archive_order_definition.go +++ b/api/datadogV2/model_logs_archive_order_definition.go @@ -107,26 +107,11 @@ func (o LogsArchiveOrderDefinition) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *LogsArchiveOrderAttributes `json:"attributes"` Type *LogsArchiveOrderDefinitionType `json:"type"` }{} - all := struct { - Attributes LogsArchiveOrderAttributes `json:"attributes"` - Type LogsArchiveOrderDefinitionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *LogsArchiveOrderDefinition) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_archives.go b/api/datadogV2/model_logs_archives.go index 1009d3f8754..7a548c56bc8 100644 --- a/api/datadogV2/model_logs_archives.go +++ b/api/datadogV2/model_logs_archives.go @@ -86,8 +86,7 @@ func (o *LogsArchives) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []LogsArchiveDefinition `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_compute.go b/api/datadogV2/model_logs_compute.go index 11646a92dbe..46d818c6231 100644 --- a/api/datadogV2/model_logs_compute.go +++ b/api/datadogV2/model_logs_compute.go @@ -182,24 +182,13 @@ func (o LogsCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *LogsAggregationFunction `json:"aggregation"` - }{} all := struct { - Aggregation LogsAggregationFunction `json:"aggregation"` - Interval *string `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - Type *LogsComputeType `json:"type,omitempty"` + Aggregation *LogsAggregationFunction `json:"aggregation"` + Interval *string `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *LogsComputeType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -207,6 +196,9 @@ func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "interval", "metric", "type"}) @@ -229,7 +221,7 @@ func (o *LogsCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric o.Type = all.Type diff --git a/api/datadogV2/model_logs_group_by.go b/api/datadogV2/model_logs_group_by.go index 18a25ca4b06..3cb083999d6 100644 --- a/api/datadogV2/model_logs_group_by.go +++ b/api/datadogV2/model_logs_group_by.go @@ -248,26 +248,15 @@ func (o LogsGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Histogram *LogsGroupByHistogram `json:"histogram,omitempty"` Limit *int64 `json:"limit,omitempty"` Missing *LogsGroupByMissing `json:"missing,omitempty"` Sort *LogsAggregateSort `json:"sort,omitempty"` Total *LogsGroupByTotal `json:"total,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -275,13 +264,16 @@ func (o *LogsGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "histogram", "limit", "missing", "sort", "total"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_logs_group_by_histogram.go b/api/datadogV2/model_logs_group_by_histogram.go index 3d3013272bc..037b9fc1e2e 100644 --- a/api/datadogV2/model_logs_group_by_histogram.go +++ b/api/datadogV2/model_logs_group_by_histogram.go @@ -135,31 +135,12 @@ func (o LogsGroupByHistogram) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Interval *float64 `json:"interval"` Max *float64 `json:"max"` Min *float64 `json:"min"` }{} - all := struct { - Interval float64 `json:"interval"` - Max float64 `json:"max"` - Min float64 `json:"min"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Interval == nil { - return fmt.Errorf("required field interval missing") - } - if required.Max == nil { - return fmt.Errorf("required field max missing") - } - if required.Min == nil { - return fmt.Errorf("required field min missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -167,15 +148,24 @@ func (o *LogsGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Interval == nil { + return fmt.Errorf("required field interval missing") + } + if all.Max == nil { + return fmt.Errorf("required field max missing") + } + if all.Min == nil { + return fmt.Errorf("required field min missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"interval", "max", "min"}) } else { return err } - o.Interval = all.Interval - o.Max = all.Max - o.Min = all.Min + o.Interval = *all.Interval + o.Max = *all.Max + o.Min = *all.Min if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_list_request.go b/api/datadogV2/model_logs_list_request.go index fabbe859320..532b93512f2 100644 --- a/api/datadogV2/model_logs_list_request.go +++ b/api/datadogV2/model_logs_list_request.go @@ -189,8 +189,7 @@ func (o *LogsListRequest) UnmarshalJSON(bytes []byte) (err error) { Page *LogsListRequestPage `json:"page,omitempty"` Sort *LogsSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_list_request_page.go b/api/datadogV2/model_logs_list_request_page.go index aaeb4123fde..8612e17819e 100644 --- a/api/datadogV2/model_logs_list_request_page.go +++ b/api/datadogV2/model_logs_list_request_page.go @@ -124,8 +124,7 @@ func (o *LogsListRequestPage) UnmarshalJSON(bytes []byte) (err error) { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_list_response.go b/api/datadogV2/model_logs_list_response.go index 9fd33057d84..609da807340 100644 --- a/api/datadogV2/model_logs_list_response.go +++ b/api/datadogV2/model_logs_list_response.go @@ -154,8 +154,7 @@ func (o *LogsListResponse) UnmarshalJSON(bytes []byte) (err error) { Links *LogsListResponseLinks `json:"links,omitempty"` Meta *LogsResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_list_response_links.go b/api/datadogV2/model_logs_list_response_links.go index 6f13c20acba..3792fc8ef41 100644 --- a/api/datadogV2/model_logs_list_response_links.go +++ b/api/datadogV2/model_logs_list_response_links.go @@ -87,8 +87,7 @@ func (o *LogsListResponseLinks) UnmarshalJSON(bytes []byte) (err error) { all := struct { Next *string `json:"next,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_compute.go b/api/datadogV2/model_logs_metric_compute.go index efd3e7d7e22..90c37a94797 100644 --- a/api/datadogV2/model_logs_metric_compute.go +++ b/api/datadogV2/model_logs_metric_compute.go @@ -145,23 +145,12 @@ func (o LogsMetricCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - AggregationType *LogsMetricComputeAggregationType `json:"aggregation_type"` - }{} all := struct { - AggregationType LogsMetricComputeAggregationType `json:"aggregation_type"` - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - Path *string `json:"path,omitempty"` + AggregationType *LogsMetricComputeAggregationType `json:"aggregation_type"` + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + Path *string `json:"path,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AggregationType == nil { - return fmt.Errorf("required field aggregation_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -169,6 +158,9 @@ func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AggregationType == nil { + return fmt.Errorf("required field aggregation_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation_type", "include_percentiles", "path"}) @@ -183,7 +175,7 @@ func (o *LogsMetricCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.AggregationType = all.AggregationType + o.AggregationType = *all.AggregationType o.IncludePercentiles = all.IncludePercentiles o.Path = all.Path if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_logs_metric_create_attributes.go b/api/datadogV2/model_logs_metric_create_attributes.go index 99585d5d602..f1f69361702 100644 --- a/api/datadogV2/model_logs_metric_create_attributes.go +++ b/api/datadogV2/model_logs_metric_create_attributes.go @@ -144,23 +144,12 @@ func (o LogsMetricCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Compute *LogsMetricCompute `json:"compute"` - }{} all := struct { - Compute LogsMetricCompute `json:"compute"` + Compute *LogsMetricCompute `json:"compute"` Filter *LogsMetricFilter `json:"filter,omitempty"` GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("required field compute missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Compute == nil { + return fmt.Errorf("required field compute missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "filter", "group_by"}) @@ -181,7 +173,7 @@ func (o *LogsMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Compute = all.Compute + o.Compute = *all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_logs_metric_create_data.go b/api/datadogV2/model_logs_metric_create_data.go index a3d6aed5093..44e51fd3c89 100644 --- a/api/datadogV2/model_logs_metric_create_data.go +++ b/api/datadogV2/model_logs_metric_create_data.go @@ -134,31 +134,12 @@ func (o LogsMetricCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *LogsMetricCreateAttributes `json:"attributes"` Id *string `json:"id"` Type *LogsMetricType `json:"type"` }{} - all := struct { - Attributes LogsMetricCreateAttributes `json:"attributes"` - Id string `json:"id"` - Type LogsMetricType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *LogsMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_metric_create_request.go b/api/datadogV2/model_logs_metric_create_request.go index 7e96e7f058a..a806b42cce1 100644 --- a/api/datadogV2/model_logs_metric_create_request.go +++ b/api/datadogV2/model_logs_metric_create_request.go @@ -78,21 +78,10 @@ func (o LogsMetricCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *LogsMetricCreateData `json:"data"` - }{} all := struct { - Data LogsMetricCreateData `json:"data"` + Data *LogsMetricCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *LogsMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_metric_filter.go b/api/datadogV2/model_logs_metric_filter.go index 2062fbf1bbc..6f7c2326302 100644 --- a/api/datadogV2/model_logs_metric_filter.go +++ b/api/datadogV2/model_logs_metric_filter.go @@ -90,8 +90,7 @@ func (o *LogsMetricFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_group_by.go b/api/datadogV2/model_logs_metric_group_by.go index 4badeeab88d..ad70a1cbed0 100644 --- a/api/datadogV2/model_logs_metric_group_by.go +++ b/api/datadogV2/model_logs_metric_group_by.go @@ -111,22 +111,11 @@ func (o LogsMetricGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Path *string `json:"path"` - }{} all := struct { - Path string `json:"path"` + Path *string `json:"path"` TagName *string `json:"tag_name,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Path == nil { - return fmt.Errorf("required field path missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *LogsMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Path == nil { + return fmt.Errorf("required field path missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"path", "tag_name"}) } else { return err } - o.Path = all.Path + o.Path = *all.Path o.TagName = all.TagName if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_logs_metric_response.go b/api/datadogV2/model_logs_metric_response.go index 927e1f050ba..8e530394592 100644 --- a/api/datadogV2/model_logs_metric_response.go +++ b/api/datadogV2/model_logs_metric_response.go @@ -86,8 +86,7 @@ func (o *LogsMetricResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *LogsMetricResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_response_attributes.go b/api/datadogV2/model_logs_metric_response_attributes.go index a92434075da..7aa95bbd133 100644 --- a/api/datadogV2/model_logs_metric_response_attributes.go +++ b/api/datadogV2/model_logs_metric_response_attributes.go @@ -154,8 +154,7 @@ func (o *LogsMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { Filter *LogsMetricResponseFilter `json:"filter,omitempty"` GroupBy []LogsMetricResponseGroupBy `json:"group_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_response_compute.go b/api/datadogV2/model_logs_metric_response_compute.go index 315113dcf04..1426c391ef9 100644 --- a/api/datadogV2/model_logs_metric_response_compute.go +++ b/api/datadogV2/model_logs_metric_response_compute.go @@ -155,8 +155,7 @@ func (o *LogsMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { IncludePercentiles *bool `json:"include_percentiles,omitempty"` Path *string `json:"path,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_response_data.go b/api/datadogV2/model_logs_metric_response_data.go index 0c2e9bb29dc..17b3c77ef90 100644 --- a/api/datadogV2/model_logs_metric_response_data.go +++ b/api/datadogV2/model_logs_metric_response_data.go @@ -158,8 +158,7 @@ func (o *LogsMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *LogsMetricType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_response_filter.go b/api/datadogV2/model_logs_metric_response_filter.go index 1c4996e3ac9..038b2a68add 100644 --- a/api/datadogV2/model_logs_metric_response_filter.go +++ b/api/datadogV2/model_logs_metric_response_filter.go @@ -86,8 +86,7 @@ func (o *LogsMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_response_group_by.go b/api/datadogV2/model_logs_metric_response_group_by.go index 9d38bf6e173..9c3c4364384 100644 --- a/api/datadogV2/model_logs_metric_response_group_by.go +++ b/api/datadogV2/model_logs_metric_response_group_by.go @@ -120,8 +120,7 @@ func (o *LogsMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { Path *string `json:"path,omitempty"` TagName *string `json:"tag_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_update_attributes.go b/api/datadogV2/model_logs_metric_update_attributes.go index bfafeae11fa..f1f4322970d 100644 --- a/api/datadogV2/model_logs_metric_update_attributes.go +++ b/api/datadogV2/model_logs_metric_update_attributes.go @@ -154,8 +154,7 @@ func (o *LogsMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { Filter *LogsMetricFilter `json:"filter,omitempty"` GroupBy []LogsMetricGroupBy `json:"group_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_update_compute.go b/api/datadogV2/model_logs_metric_update_compute.go index a7e082812eb..63395715692 100644 --- a/api/datadogV2/model_logs_metric_update_compute.go +++ b/api/datadogV2/model_logs_metric_update_compute.go @@ -87,8 +87,7 @@ func (o *LogsMetricUpdateCompute) UnmarshalJSON(bytes []byte) (err error) { all := struct { IncludePercentiles *bool `json:"include_percentiles,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_metric_update_data.go b/api/datadogV2/model_logs_metric_update_data.go index 03de7dbba56..da5aaacc849 100644 --- a/api/datadogV2/model_logs_metric_update_data.go +++ b/api/datadogV2/model_logs_metric_update_data.go @@ -107,26 +107,11 @@ func (o LogsMetricUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *LogsMetricUpdateAttributes `json:"attributes"` Type *LogsMetricType `json:"type"` }{} - all := struct { - Attributes LogsMetricUpdateAttributes `json:"attributes"` - Type LogsMetricType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *LogsMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_metric_update_request.go b/api/datadogV2/model_logs_metric_update_request.go index 7fb6556e86f..4a6c462301d 100644 --- a/api/datadogV2/model_logs_metric_update_request.go +++ b/api/datadogV2/model_logs_metric_update_request.go @@ -78,21 +78,10 @@ func (o LogsMetricUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *LogsMetricUpdateData `json:"data"` - }{} all := struct { - Data LogsMetricUpdateData `json:"data"` + Data *LogsMetricUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *LogsMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_logs_metrics_response.go b/api/datadogV2/model_logs_metrics_response.go index 57e62111957..551edd6c020 100644 --- a/api/datadogV2/model_logs_metrics_response.go +++ b/api/datadogV2/model_logs_metrics_response.go @@ -86,8 +86,7 @@ func (o *LogsMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []LogsMetricResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_query_filter.go b/api/datadogV2/model_logs_query_filter.go index 437a8538146..b269be3a17d 100644 --- a/api/datadogV2/model_logs_query_filter.go +++ b/api/datadogV2/model_logs_query_filter.go @@ -238,8 +238,7 @@ func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) { StorageTier *LogsStorageTier `json:"storage_tier,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_query_options.go b/api/datadogV2/model_logs_query_options.go index 8062243ac47..2f5c6f501aa 100644 --- a/api/datadogV2/model_logs_query_options.go +++ b/api/datadogV2/model_logs_query_options.go @@ -125,8 +125,7 @@ func (o *LogsQueryOptions) UnmarshalJSON(bytes []byte) (err error) { TimeOffset *int64 `json:"timeOffset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_response_metadata.go b/api/datadogV2/model_logs_response_metadata.go index ba30e209848..e6c8ab66085 100644 --- a/api/datadogV2/model_logs_response_metadata.go +++ b/api/datadogV2/model_logs_response_metadata.go @@ -223,8 +223,7 @@ func (o *LogsResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Status *LogsAggregateResponseStatus `json:"status,omitempty"` Warnings []LogsWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_response_metadata_page.go b/api/datadogV2/model_logs_response_metadata_page.go index c6e150fb2e7..51bfae5ea61 100644 --- a/api/datadogV2/model_logs_response_metadata_page.go +++ b/api/datadogV2/model_logs_response_metadata_page.go @@ -87,8 +87,7 @@ func (o *LogsResponseMetadataPage) UnmarshalJSON(bytes []byte) (err error) { all := struct { After *string `json:"after,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_logs_warning.go b/api/datadogV2/model_logs_warning.go index 06e70389881..0fde40f6b41 100644 --- a/api/datadogV2/model_logs_warning.go +++ b/api/datadogV2/model_logs_warning.go @@ -154,8 +154,7 @@ func (o *LogsWarning) UnmarshalJSON(bytes []byte) (err error) { Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric.go b/api/datadogV2/model_metric.go index 85d0d3c1163..1a86db482c6 100644 --- a/api/datadogV2/model_metric.go +++ b/api/datadogV2/model_metric.go @@ -124,8 +124,7 @@ func (o *Metric) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *MetricType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_all_tags.go b/api/datadogV2/model_metric_all_tags.go index 88a9be40bb8..6942118b43d 100644 --- a/api/datadogV2/model_metric_all_tags.go +++ b/api/datadogV2/model_metric_all_tags.go @@ -158,8 +158,7 @@ func (o *MetricAllTags) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *MetricType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_all_tags_attributes.go b/api/datadogV2/model_metric_all_tags_attributes.go index 8d16963187f..7a2430d00d9 100644 --- a/api/datadogV2/model_metric_all_tags_attributes.go +++ b/api/datadogV2/model_metric_all_tags_attributes.go @@ -86,8 +86,7 @@ func (o *MetricAllTagsAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_all_tags_response.go b/api/datadogV2/model_metric_all_tags_response.go index 2c0624d457b..7ea22a00277 100644 --- a/api/datadogV2/model_metric_all_tags_response.go +++ b/api/datadogV2/model_metric_all_tags_response.go @@ -86,8 +86,7 @@ func (o *MetricAllTagsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *MetricAllTags `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_bulk_tag_config_create.go b/api/datadogV2/model_metric_bulk_tag_config_create.go index 09013e3fd0d..32035e33185 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_create.go +++ b/api/datadogV2/model_metric_bulk_tag_config_create.go @@ -140,27 +140,12 @@ func (o MetricBulkTagConfigCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricBulkConfigureTagsType `json:"type"` - }{} all := struct { Attributes *MetricBulkTagConfigCreateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricBulkConfigureTagsType `json:"type"` + Id *string `json:"id"` + Type *MetricBulkConfigureTagsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *MetricBulkTagConfigCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go b/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go index 6979982dce8..82a5650e8bf 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go +++ b/api/datadogV2/model_metric_bulk_tag_config_create_attributes.go @@ -120,8 +120,7 @@ func (o *MetricBulkTagConfigCreateAttributes) UnmarshalJSON(bytes []byte) (err e Emails []string `json:"emails,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_bulk_tag_config_create_request.go b/api/datadogV2/model_metric_bulk_tag_config_create_request.go index 2a5e4d6514a..ab3e1179f4f 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_create_request.go +++ b/api/datadogV2/model_metric_bulk_tag_config_create_request.go @@ -78,21 +78,10 @@ func (o MetricBulkTagConfigCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MetricBulkTagConfigCreate `json:"data"` - }{} all := struct { - Data MetricBulkTagConfigCreate `json:"data"` + Data *MetricBulkTagConfigCreate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MetricBulkTagConfigCreateRequest) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_bulk_tag_config_delete.go b/api/datadogV2/model_metric_bulk_tag_config_delete.go index c7a443a6628..38bcc7f7c76 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_delete.go +++ b/api/datadogV2/model_metric_bulk_tag_config_delete.go @@ -140,27 +140,12 @@ func (o MetricBulkTagConfigDelete) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricBulkConfigureTagsType `json:"type"` - }{} all := struct { Attributes *MetricBulkTagConfigDeleteAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricBulkConfigureTagsType `json:"type"` + Id *string `json:"id"` + Type *MetricBulkConfigureTagsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *MetricBulkTagConfigDelete) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go b/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go index c94066600f9..fd73ee4c37e 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go +++ b/api/datadogV2/model_metric_bulk_tag_config_delete_attributes.go @@ -86,8 +86,7 @@ func (o *MetricBulkTagConfigDeleteAttributes) UnmarshalJSON(bytes []byte) (err e all := struct { Emails []string `json:"emails,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_bulk_tag_config_delete_request.go b/api/datadogV2/model_metric_bulk_tag_config_delete_request.go index 74e0fc50511..8a58671be6f 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_delete_request.go +++ b/api/datadogV2/model_metric_bulk_tag_config_delete_request.go @@ -78,21 +78,10 @@ func (o MetricBulkTagConfigDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MetricBulkTagConfigDelete `json:"data"` - }{} all := struct { - Data MetricBulkTagConfigDelete `json:"data"` + Data *MetricBulkTagConfigDelete `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MetricBulkTagConfigDeleteRequest) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_bulk_tag_config_response.go b/api/datadogV2/model_metric_bulk_tag_config_response.go index a7ace4392ec..f459bb8e01c 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_response.go +++ b/api/datadogV2/model_metric_bulk_tag_config_response.go @@ -87,8 +87,7 @@ func (o *MetricBulkTagConfigResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *MetricBulkTagConfigStatus `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_bulk_tag_config_status.go b/api/datadogV2/model_metric_bulk_tag_config_status.go index 3e20d522a85..2f3ccb2bc4e 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_status.go +++ b/api/datadogV2/model_metric_bulk_tag_config_status.go @@ -141,27 +141,12 @@ func (o MetricBulkTagConfigStatus) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricBulkConfigureTagsType `json:"type"` - }{} all := struct { Attributes *MetricBulkTagConfigStatusAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricBulkConfigureTagsType `json:"type"` + Id *string `json:"id"` + Type *MetricBulkConfigureTagsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -169,6 +154,12 @@ func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -191,8 +182,8 @@ func (o *MetricBulkTagConfigStatus) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go b/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go index 59d42423b91..3f30c7698ad 100644 --- a/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go +++ b/api/datadogV2/model_metric_bulk_tag_config_status_attributes.go @@ -154,8 +154,7 @@ func (o *MetricBulkTagConfigStatusAttributes) UnmarshalJSON(bytes []byte) (err e Status *string `json:"status,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_custom_aggregation.go b/api/datadogV2/model_metric_custom_aggregation.go index e6389f2ede3..bd0c84eeedc 100644 --- a/api/datadogV2/model_metric_custom_aggregation.go +++ b/api/datadogV2/model_metric_custom_aggregation.go @@ -105,26 +105,11 @@ func (o MetricCustomAggregation) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Space *MetricCustomSpaceAggregation `json:"space"` Time *MetricCustomTimeAggregation `json:"time"` }{} - all := struct { - Space MetricCustomSpaceAggregation `json:"space"` - Time MetricCustomTimeAggregation `json:"time"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Space == nil { - return fmt.Errorf("required field space missing") - } - if required.Time == nil { - return fmt.Errorf("required field time missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Space == nil { + return fmt.Errorf("required field space missing") + } + if all.Time == nil { + return fmt.Errorf("required field time missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"space", "time"}) @@ -154,8 +145,8 @@ func (o *MetricCustomAggregation) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Space = all.Space - o.Time = all.Time + o.Space = *all.Space + o.Time = *all.Time if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_distinct_volume.go b/api/datadogV2/model_metric_distinct_volume.go index 8f5fb247d44..d86af93baef 100644 --- a/api/datadogV2/model_metric_distinct_volume.go +++ b/api/datadogV2/model_metric_distinct_volume.go @@ -158,8 +158,7 @@ func (o *MetricDistinctVolume) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *MetricDistinctVolumeType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_distinct_volume_attributes.go b/api/datadogV2/model_metric_distinct_volume_attributes.go index 8ce38e8a402..c124573a4d5 100644 --- a/api/datadogV2/model_metric_distinct_volume_attributes.go +++ b/api/datadogV2/model_metric_distinct_volume_attributes.go @@ -86,8 +86,7 @@ func (o *MetricDistinctVolumeAttributes) UnmarshalJSON(bytes []byte) (err error) all := struct { DistinctVolume *int64 `json:"distinct_volume,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_estimate.go b/api/datadogV2/model_metric_estimate.go index 1cf7d91eadf..739770ed6bb 100644 --- a/api/datadogV2/model_metric_estimate.go +++ b/api/datadogV2/model_metric_estimate.go @@ -158,8 +158,7 @@ func (o *MetricEstimate) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *MetricEstimateResourceType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_estimate_attributes.go b/api/datadogV2/model_metric_estimate_attributes.go index 5da62e1db46..da11f32f647 100644 --- a/api/datadogV2/model_metric_estimate_attributes.go +++ b/api/datadogV2/model_metric_estimate_attributes.go @@ -163,8 +163,7 @@ func (o *MetricEstimateAttributes) UnmarshalJSON(bytes []byte) (err error) { EstimatedAt *time.Time `json:"estimated_at,omitempty"` EstimatedOutputSeries *int64 `json:"estimated_output_series,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_estimate_response.go b/api/datadogV2/model_metric_estimate_response.go index ac3a372e8ed..856f8ae834f 100644 --- a/api/datadogV2/model_metric_estimate_response.go +++ b/api/datadogV2/model_metric_estimate_response.go @@ -86,8 +86,7 @@ func (o *MetricEstimateResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *MetricEstimate `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_ingested_indexed_volume.go b/api/datadogV2/model_metric_ingested_indexed_volume.go index e0271c5f027..41ca5525d96 100644 --- a/api/datadogV2/model_metric_ingested_indexed_volume.go +++ b/api/datadogV2/model_metric_ingested_indexed_volume.go @@ -158,8 +158,7 @@ func (o *MetricIngestedIndexedVolume) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *MetricIngestedIndexedVolumeType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go b/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go index e9151d2de31..c9238e7313b 100644 --- a/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go +++ b/api/datadogV2/model_metric_ingested_indexed_volume_attributes.go @@ -120,8 +120,7 @@ func (o *MetricIngestedIndexedVolumeAttributes) UnmarshalJSON(bytes []byte) (err IndexedVolume *int64 `json:"indexed_volume,omitempty"` IngestedVolume *int64 `json:"ingested_volume,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_metadata.go b/api/datadogV2/model_metric_metadata.go index 15b83d583c6..a8c5f9de989 100644 --- a/api/datadogV2/model_metric_metadata.go +++ b/api/datadogV2/model_metric_metadata.go @@ -86,8 +86,7 @@ func (o *MetricMetadata) UnmarshalJSON(bytes []byte) (err error) { all := struct { Origin *MetricOrigin `json:"origin,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_origin.go b/api/datadogV2/model_metric_origin.go index 6413bb654b6..415970f945c 100644 --- a/api/datadogV2/model_metric_origin.go +++ b/api/datadogV2/model_metric_origin.go @@ -166,8 +166,7 @@ func (o *MetricOrigin) UnmarshalJSON(bytes []byte) (err error) { Product *int32 `json:"product,omitempty"` Service *int32 `json:"service,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_payload.go b/api/datadogV2/model_metric_payload.go index 8d64042cfa8..910e32b68ca 100644 --- a/api/datadogV2/model_metric_payload.go +++ b/api/datadogV2/model_metric_payload.go @@ -78,21 +78,10 @@ func (o MetricPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricPayload) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Series *[]MetricSeries `json:"series"` - }{} all := struct { - Series []MetricSeries `json:"series"` + Series *[]MetricSeries `json:"series"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Series == nil { - return fmt.Errorf("required field series missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *MetricPayload) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Series == nil { + return fmt.Errorf("required field series missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"series"}) } else { return err } - o.Series = all.Series + o.Series = *all.Series if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_point.go b/api/datadogV2/model_metric_point.go index cd3be5f1df8..2fd8d1c6378 100644 --- a/api/datadogV2/model_metric_point.go +++ b/api/datadogV2/model_metric_point.go @@ -121,8 +121,7 @@ func (o *MetricPoint) UnmarshalJSON(bytes []byte) (err error) { Timestamp *int64 `json:"timestamp,omitempty"` Value *float64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_resource.go b/api/datadogV2/model_metric_resource.go index db0645a1b55..5a0cf32e0dd 100644 --- a/api/datadogV2/model_metric_resource.go +++ b/api/datadogV2/model_metric_resource.go @@ -120,8 +120,7 @@ func (o *MetricResource) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_series.go b/api/datadogV2/model_metric_series.go index 7d1d6ca4fb0..16b7a7b56be 100644 --- a/api/datadogV2/model_metric_series.go +++ b/api/datadogV2/model_metric_series.go @@ -337,33 +337,18 @@ func (o MetricSeries) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Metric *string `json:"metric"` - Points *[]MetricPoint `json:"points"` - }{} all := struct { Interval *int64 `json:"interval,omitempty"` Metadata *MetricMetadata `json:"metadata,omitempty"` - Metric string `json:"metric"` - Points []MetricPoint `json:"points"` + Metric *string `json:"metric"` + Points *[]MetricPoint `json:"points"` Resources []MetricResource `json:"resources,omitempty"` SourceTypeName *string `json:"source_type_name,omitempty"` Tags []string `json:"tags,omitempty"` Type *MetricIntakeType `json:"type,omitempty"` Unit *string `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Metric == nil { - return fmt.Errorf("required field metric missing") - } - if required.Points == nil { - return fmt.Errorf("required field points missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -371,6 +356,12 @@ func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Metric == nil { + return fmt.Errorf("required field metric missing") + } + if all.Points == nil { + return fmt.Errorf("required field points missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"interval", "metadata", "metric", "points", "resources", "source_type_name", "tags", "type", "unit"}) @@ -394,8 +385,8 @@ func (o *MetricSeries) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Metadata = all.Metadata - o.Metric = all.Metric - o.Points = all.Points + o.Metric = *all.Metric + o.Points = *all.Points o.Resources = all.Resources o.SourceTypeName = all.SourceTypeName o.Tags = all.Tags diff --git a/api/datadogV2/model_metric_suggested_tags_and_aggregations.go b/api/datadogV2/model_metric_suggested_tags_and_aggregations.go index b788d37fa5d..500042ec3d2 100644 --- a/api/datadogV2/model_metric_suggested_tags_and_aggregations.go +++ b/api/datadogV2/model_metric_suggested_tags_and_aggregations.go @@ -158,8 +158,7 @@ func (o *MetricSuggestedTagsAndAggregations) UnmarshalJSON(bytes []byte) (err er Id *string `json:"id,omitempty"` Type *MetricActiveConfigurationType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go b/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go index 0919506ac29..ea01cbd1549 100644 --- a/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go +++ b/api/datadogV2/model_metric_suggested_tags_and_aggregations_response.go @@ -86,8 +86,7 @@ func (o *MetricSuggestedTagsAndAggregationsResponse) UnmarshalJSON(bytes []byte) all := struct { Data *MetricSuggestedTagsAndAggregations `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_suggested_tags_attributes.go b/api/datadogV2/model_metric_suggested_tags_attributes.go index 779ff11fc75..910004eb60f 100644 --- a/api/datadogV2/model_metric_suggested_tags_attributes.go +++ b/api/datadogV2/model_metric_suggested_tags_attributes.go @@ -120,8 +120,7 @@ func (o *MetricSuggestedTagsAttributes) UnmarshalJSON(bytes []byte) (err error) ActiveAggregations []MetricCustomAggregation `json:"active_aggregations,omitempty"` ActiveTags []string `json:"active_tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_tag_configuration.go b/api/datadogV2/model_metric_tag_configuration.go index 98a144380fc..de9dae0fef2 100644 --- a/api/datadogV2/model_metric_tag_configuration.go +++ b/api/datadogV2/model_metric_tag_configuration.go @@ -158,8 +158,7 @@ func (o *MetricTagConfiguration) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *MetricTagConfigurationType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_tag_configuration_attributes.go b/api/datadogV2/model_metric_tag_configuration_attributes.go index dfa419d9148..6c8f1353dc2 100644 --- a/api/datadogV2/model_metric_tag_configuration_attributes.go +++ b/api/datadogV2/model_metric_tag_configuration_attributes.go @@ -285,8 +285,7 @@ func (o *MetricTagConfigurationAttributes) UnmarshalJSON(bytes []byte) (err erro ModifiedAt *time.Time `json:"modified_at,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_tag_configuration_create_attributes.go b/api/datadogV2/model_metric_tag_configuration_create_attributes.go index 8a1f8a8bcda..08cf47a0207 100644 --- a/api/datadogV2/model_metric_tag_configuration_create_attributes.go +++ b/api/datadogV2/model_metric_tag_configuration_create_attributes.go @@ -189,28 +189,13 @@ func (o MetricTagConfigurationCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - MetricType *MetricTagConfigurationMetricTypes `json:"metric_type"` - Tags *[]string `json:"tags"` - }{} all := struct { - Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - MetricType MetricTagConfigurationMetricTypes `json:"metric_type"` - Tags []string `json:"tags"` + Aggregations []MetricCustomAggregation `json:"aggregations,omitempty"` + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + MetricType *MetricTagConfigurationMetricTypes `json:"metric_type"` + Tags *[]string `json:"tags"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.MetricType == nil { - return fmt.Errorf("required field metric_type missing") - } - if required.Tags == nil { - return fmt.Errorf("required field tags missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -218,6 +203,12 @@ func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (er o.UnparsedObject = raw return nil } + if all.MetricType == nil { + return fmt.Errorf("required field metric_type missing") + } + if all.Tags == nil { + return fmt.Errorf("required field tags missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregations", "include_percentiles", "metric_type", "tags"}) @@ -234,8 +225,8 @@ func (o *MetricTagConfigurationCreateAttributes) UnmarshalJSON(bytes []byte) (er } o.Aggregations = all.Aggregations o.IncludePercentiles = all.IncludePercentiles - o.MetricType = all.MetricType - o.Tags = all.Tags + o.MetricType = *all.MetricType + o.Tags = *all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_tag_configuration_create_data.go b/api/datadogV2/model_metric_tag_configuration_create_data.go index 46b07d524f9..1b3dc18f51c 100644 --- a/api/datadogV2/model_metric_tag_configuration_create_data.go +++ b/api/datadogV2/model_metric_tag_configuration_create_data.go @@ -140,27 +140,12 @@ func (o MetricTagConfigurationCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricTagConfigurationType `json:"type"` - }{} all := struct { Attributes *MetricTagConfigurationCreateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricTagConfigurationType `json:"type"` + Id *string `json:"id"` + Type *MetricTagConfigurationType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *MetricTagConfigurationCreateData) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_tag_configuration_create_request.go b/api/datadogV2/model_metric_tag_configuration_create_request.go index 0b8eb9c7d2b..ba2d5e1931a 100644 --- a/api/datadogV2/model_metric_tag_configuration_create_request.go +++ b/api/datadogV2/model_metric_tag_configuration_create_request.go @@ -78,21 +78,10 @@ func (o MetricTagConfigurationCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MetricTagConfigurationCreateData `json:"data"` - }{} all := struct { - Data MetricTagConfigurationCreateData `json:"data"` + Data *MetricTagConfigurationCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MetricTagConfigurationCreateRequest) UnmarshalJSON(bytes []byte) (err e } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_tag_configuration_response.go b/api/datadogV2/model_metric_tag_configuration_response.go index fe7ea10ff1b..bca49efdf70 100644 --- a/api/datadogV2/model_metric_tag_configuration_response.go +++ b/api/datadogV2/model_metric_tag_configuration_response.go @@ -86,8 +86,7 @@ func (o *MetricTagConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data *MetricTagConfiguration `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_tag_configuration_update_attributes.go b/api/datadogV2/model_metric_tag_configuration_update_attributes.go index cc1f01ed8b1..2984f5a3621 100644 --- a/api/datadogV2/model_metric_tag_configuration_update_attributes.go +++ b/api/datadogV2/model_metric_tag_configuration_update_attributes.go @@ -170,8 +170,7 @@ func (o *MetricTagConfigurationUpdateAttributes) UnmarshalJSON(bytes []byte) (er IncludePercentiles *bool `json:"include_percentiles,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metric_tag_configuration_update_data.go b/api/datadogV2/model_metric_tag_configuration_update_data.go index ae23b9c0631..1ecbe509d3e 100644 --- a/api/datadogV2/model_metric_tag_configuration_update_data.go +++ b/api/datadogV2/model_metric_tag_configuration_update_data.go @@ -140,27 +140,12 @@ func (o MetricTagConfigurationUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *MetricTagConfigurationType `json:"type"` - }{} all := struct { Attributes *MetricTagConfigurationUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type MetricTagConfigurationType `json:"type"` + Id *string `json:"id"` + Type *MetricTagConfigurationType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *MetricTagConfigurationUpdateData) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_tag_configuration_update_request.go b/api/datadogV2/model_metric_tag_configuration_update_request.go index 4da5d0eddc6..a4f91e4039f 100644 --- a/api/datadogV2/model_metric_tag_configuration_update_request.go +++ b/api/datadogV2/model_metric_tag_configuration_update_request.go @@ -78,21 +78,10 @@ func (o MetricTagConfigurationUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MetricTagConfigurationUpdateData `json:"data"` - }{} all := struct { - Data MetricTagConfigurationUpdateData `json:"data"` + Data *MetricTagConfigurationUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MetricTagConfigurationUpdateRequest) UnmarshalJSON(bytes []byte) (err e } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metric_volumes_response.go b/api/datadogV2/model_metric_volumes_response.go index 5cb689ab924..df860f0e1f7 100644 --- a/api/datadogV2/model_metric_volumes_response.go +++ b/api/datadogV2/model_metric_volumes_response.go @@ -86,8 +86,7 @@ func (o *MetricVolumesResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *MetricVolumes `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go b/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go index 8a749de1424..d060cd6f083 100644 --- a/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go +++ b/api/datadogV2/model_metrics_and_metric_tag_configurations_response.go @@ -86,8 +86,7 @@ func (o *MetricsAndMetricTagConfigurationsResponse) UnmarshalJSON(bytes []byte) all := struct { Data []MetricsAndMetricTagConfigurations `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_metrics_scalar_query.go b/api/datadogV2/model_metrics_scalar_query.go index cd5df59373e..f5a7b75faa1 100644 --- a/api/datadogV2/model_metrics_scalar_query.go +++ b/api/datadogV2/model_metrics_scalar_query.go @@ -169,32 +169,13 @@ func (o MetricsScalarQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Aggregator *MetricsAggregator `json:"aggregator"` DataSource *MetricsDataSource `json:"data_source"` + Name *string `json:"name,omitempty"` Query *string `json:"query"` }{} - all := struct { - Aggregator MetricsAggregator `json:"aggregator"` - DataSource MetricsDataSource `json:"data_source"` - Name *string `json:"name,omitempty"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregator == nil { - return fmt.Errorf("required field aggregator missing") - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +183,15 @@ func (o *MetricsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregator == nil { + return fmt.Errorf("required field aggregator missing") + } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregator", "data_source", "name", "query"}) @@ -224,10 +214,10 @@ func (o *MetricsScalarQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregator = all.Aggregator - o.DataSource = all.DataSource + o.Aggregator = *all.Aggregator + o.DataSource = *all.DataSource o.Name = all.Name - o.Query = all.Query + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_metrics_timeseries_query.go b/api/datadogV2/model_metrics_timeseries_query.go index 5474bc2ee7e..ee6ef899bc0 100644 --- a/api/datadogV2/model_metrics_timeseries_query.go +++ b/api/datadogV2/model_metrics_timeseries_query.go @@ -140,27 +140,12 @@ func (o MetricsTimeseriesQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MetricsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { DataSource *MetricsDataSource `json:"data_source"` + Name *string `json:"name,omitempty"` Query *string `json:"query"` }{} - all := struct { - DataSource MetricsDataSource `json:"data_source"` - Name *string `json:"name,omitempty"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DataSource == nil { - return fmt.Errorf("required field data_source missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *MetricsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DataSource == nil { + return fmt.Errorf("required field data_source missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data_source", "name", "query"}) @@ -182,9 +173,9 @@ func (o *MetricsTimeseriesQuery) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.DataSource = all.DataSource + o.DataSource = *all.DataSource o.Name = all.Name - o.Query = all.Query + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_attribute_create_request.go b/api/datadogV2/model_monitor_config_policy_attribute_create_request.go index 786ceceb12b..36c118bf9f4 100644 --- a/api/datadogV2/model_monitor_config_policy_attribute_create_request.go +++ b/api/datadogV2/model_monitor_config_policy_attribute_create_request.go @@ -107,26 +107,11 @@ func (o MonitorConfigPolicyAttributeCreateRequest) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyAttributeCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Policy *MonitorConfigPolicyPolicyCreateRequest `json:"policy"` PolicyType *MonitorConfigPolicyType `json:"policy_type"` }{} - all := struct { - Policy MonitorConfigPolicyPolicyCreateRequest `json:"policy"` - PolicyType MonitorConfigPolicyType `json:"policy_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Policy == nil { - return fmt.Errorf("required field policy missing") - } - if required.PolicyType == nil { - return fmt.Errorf("required field policy_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *MonitorConfigPolicyAttributeCreateRequest) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.Policy == nil { + return fmt.Errorf("required field policy missing") + } + if all.PolicyType == nil { + return fmt.Errorf("required field policy_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"policy", "policy_type"}) @@ -148,8 +139,8 @@ func (o *MonitorConfigPolicyAttributeCreateRequest) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } - o.Policy = all.Policy - o.PolicyType = all.PolicyType + o.Policy = *all.Policy + o.PolicyType = *all.PolicyType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go b/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go index 07c7d10e5bd..2600cfdb97e 100644 --- a/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go +++ b/api/datadogV2/model_monitor_config_policy_attribute_edit_request.go @@ -107,26 +107,11 @@ func (o MonitorConfigPolicyAttributeEditRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyAttributeEditRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Policy *MonitorConfigPolicyPolicy `json:"policy"` PolicyType *MonitorConfigPolicyType `json:"policy_type"` }{} - all := struct { - Policy MonitorConfigPolicyPolicy `json:"policy"` - PolicyType MonitorConfigPolicyType `json:"policy_type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Policy == nil { - return fmt.Errorf("required field policy missing") - } - if required.PolicyType == nil { - return fmt.Errorf("required field policy_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *MonitorConfigPolicyAttributeEditRequest) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.Policy == nil { + return fmt.Errorf("required field policy missing") + } + if all.PolicyType == nil { + return fmt.Errorf("required field policy_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"policy", "policy_type"}) @@ -148,8 +139,8 @@ func (o *MonitorConfigPolicyAttributeEditRequest) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } - o.Policy = all.Policy - o.PolicyType = all.PolicyType + o.Policy = *all.Policy + o.PolicyType = *all.PolicyType if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_attribute_response.go b/api/datadogV2/model_monitor_config_policy_attribute_response.go index 8d86bf35767..a6cced2a239 100644 --- a/api/datadogV2/model_monitor_config_policy_attribute_response.go +++ b/api/datadogV2/model_monitor_config_policy_attribute_response.go @@ -124,8 +124,7 @@ func (o *MonitorConfigPolicyAttributeResponse) UnmarshalJSON(bytes []byte) (err Policy *MonitorConfigPolicyPolicy `json:"policy,omitempty"` PolicyType *MonitorConfigPolicyType `json:"policy_type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_monitor_config_policy_create_data.go b/api/datadogV2/model_monitor_config_policy_create_data.go index f74b9b94954..0a5cc02c79a 100644 --- a/api/datadogV2/model_monitor_config_policy_create_data.go +++ b/api/datadogV2/model_monitor_config_policy_create_data.go @@ -107,26 +107,11 @@ func (o MonitorConfigPolicyCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *MonitorConfigPolicyAttributeCreateRequest `json:"attributes"` Type *MonitorConfigPolicyResourceType `json:"type"` }{} - all := struct { - Attributes MonitorConfigPolicyAttributeCreateRequest `json:"attributes"` - Type MonitorConfigPolicyResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *MonitorConfigPolicyCreateData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *MonitorConfigPolicyCreateData) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_create_request.go b/api/datadogV2/model_monitor_config_policy_create_request.go index 3c932233355..57f2615f5c0 100644 --- a/api/datadogV2/model_monitor_config_policy_create_request.go +++ b/api/datadogV2/model_monitor_config_policy_create_request.go @@ -78,21 +78,10 @@ func (o MonitorConfigPolicyCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MonitorConfigPolicyCreateData `json:"data"` - }{} all := struct { - Data MonitorConfigPolicyCreateData `json:"data"` + Data *MonitorConfigPolicyCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MonitorConfigPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MonitorConfigPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_edit_data.go b/api/datadogV2/model_monitor_config_policy_edit_data.go index bb709567019..62b100d88be 100644 --- a/api/datadogV2/model_monitor_config_policy_edit_data.go +++ b/api/datadogV2/model_monitor_config_policy_edit_data.go @@ -134,31 +134,12 @@ func (o MonitorConfigPolicyEditData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyEditData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *MonitorConfigPolicyAttributeEditRequest `json:"attributes"` Id *string `json:"id"` Type *MonitorConfigPolicyResourceType `json:"type"` }{} - all := struct { - Attributes MonitorConfigPolicyAttributeEditRequest `json:"attributes"` - Id string `json:"id"` - Type MonitorConfigPolicyResourceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *MonitorConfigPolicyEditData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *MonitorConfigPolicyEditData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_edit_request.go b/api/datadogV2/model_monitor_config_policy_edit_request.go index 153dded6e2a..de3cca2cf97 100644 --- a/api/datadogV2/model_monitor_config_policy_edit_request.go +++ b/api/datadogV2/model_monitor_config_policy_edit_request.go @@ -78,21 +78,10 @@ func (o MonitorConfigPolicyEditRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyEditRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MonitorConfigPolicyEditData `json:"data"` - }{} all := struct { - Data MonitorConfigPolicyEditData `json:"data"` + Data *MonitorConfigPolicyEditData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MonitorConfigPolicyEditRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MonitorConfigPolicyEditRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_config_policy_list_response.go b/api/datadogV2/model_monitor_config_policy_list_response.go index d9ff2f2fc1b..7eba96d954e 100644 --- a/api/datadogV2/model_monitor_config_policy_list_response.go +++ b/api/datadogV2/model_monitor_config_policy_list_response.go @@ -86,8 +86,7 @@ func (o *MonitorConfigPolicyListResponse) UnmarshalJSON(bytes []byte) (err error all := struct { Data []MonitorConfigPolicyResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_monitor_config_policy_response.go b/api/datadogV2/model_monitor_config_policy_response.go index af08bec61ff..5324427e1df 100644 --- a/api/datadogV2/model_monitor_config_policy_response.go +++ b/api/datadogV2/model_monitor_config_policy_response.go @@ -86,8 +86,7 @@ func (o *MonitorConfigPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *MonitorConfigPolicyResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_monitor_config_policy_response_data.go b/api/datadogV2/model_monitor_config_policy_response_data.go index 3c6777275a4..451d8033597 100644 --- a/api/datadogV2/model_monitor_config_policy_response_data.go +++ b/api/datadogV2/model_monitor_config_policy_response_data.go @@ -158,8 +158,7 @@ func (o *MonitorConfigPolicyResponseData) UnmarshalJSON(bytes []byte) (err error Id *string `json:"id,omitempty"` Type *MonitorConfigPolicyResourceType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_monitor_config_policy_tag_policy.go b/api/datadogV2/model_monitor_config_policy_tag_policy.go index c4ffc7f3d0e..f98b181b4a1 100644 --- a/api/datadogV2/model_monitor_config_policy_tag_policy.go +++ b/api/datadogV2/model_monitor_config_policy_tag_policy.go @@ -154,8 +154,7 @@ func (o *MonitorConfigPolicyTagPolicy) UnmarshalJSON(bytes []byte) (err error) { TagKeyRequired *bool `json:"tag_key_required,omitempty"` ValidTagValues []string `json:"valid_tag_values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go b/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go index 0ef83e61622..5320d7cb3ae 100644 --- a/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go +++ b/api/datadogV2/model_monitor_config_policy_tag_policy_create_request.go @@ -132,31 +132,12 @@ func (o MonitorConfigPolicyTagPolicyCreateRequest) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *MonitorConfigPolicyTagPolicyCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { TagKey *string `json:"tag_key"` TagKeyRequired *bool `json:"tag_key_required"` ValidTagValues *[]string `json:"valid_tag_values"` }{} - all := struct { - TagKey string `json:"tag_key"` - TagKeyRequired bool `json:"tag_key_required"` - ValidTagValues []string `json:"valid_tag_values"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.TagKey == nil { - return fmt.Errorf("required field tag_key missing") - } - if required.TagKeyRequired == nil { - return fmt.Errorf("required field tag_key_required missing") - } - if required.ValidTagValues == nil { - return fmt.Errorf("required field valid_tag_values missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -164,15 +145,24 @@ func (o *MonitorConfigPolicyTagPolicyCreateRequest) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.TagKey == nil { + return fmt.Errorf("required field tag_key missing") + } + if all.TagKeyRequired == nil { + return fmt.Errorf("required field tag_key_required missing") + } + if all.ValidTagValues == nil { + return fmt.Errorf("required field valid_tag_values missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"tag_key", "tag_key_required", "valid_tag_values"}) } else { return err } - o.TagKey = all.TagKey - o.TagKeyRequired = all.TagKeyRequired - o.ValidTagValues = all.ValidTagValues + o.TagKey = *all.TagKey + o.TagKeyRequired = *all.TagKeyRequired + o.ValidTagValues = *all.ValidTagValues if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_monitor_type.go b/api/datadogV2/model_monitor_type.go index 581d81d3176..d52f29c9c50 100644 --- a/api/datadogV2/model_monitor_type.go +++ b/api/datadogV2/model_monitor_type.go @@ -426,8 +426,7 @@ func (o *MonitorType) UnmarshalJSON(bytes []byte) (err error) { TemplatedName *string `json:"templated_name,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_mute_finding_request.go b/api/datadogV2/model_mute_finding_request.go index fd78bf45f89..a9f1028d2b2 100644 --- a/api/datadogV2/model_mute_finding_request.go +++ b/api/datadogV2/model_mute_finding_request.go @@ -78,21 +78,10 @@ func (o MuteFindingRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MuteFindingRequestData `json:"data"` - }{} all := struct { - Data MuteFindingRequestData `json:"data"` + Data *MuteFindingRequestData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MuteFindingRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MuteFindingRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_mute_finding_request_attributes.go b/api/datadogV2/model_mute_finding_request_attributes.go index 3cb3793ef93..6f508387f79 100644 --- a/api/datadogV2/model_mute_finding_request_attributes.go +++ b/api/datadogV2/model_mute_finding_request_attributes.go @@ -71,21 +71,10 @@ func (o MuteFindingRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Mute *MuteFindingRequestProperties `json:"mute"` - }{} all := struct { - Mute MuteFindingRequestProperties `json:"mute"` + Mute *MuteFindingRequestProperties `json:"mute"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Mute == nil { - return fmt.Errorf("required field mute missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -93,6 +82,9 @@ func (o *MuteFindingRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Mute == nil { + return fmt.Errorf("required field mute missing") + } if all.Mute.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -100,7 +92,7 @@ func (o *MuteFindingRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Mute = all.Mute + o.Mute = *all.Mute return nil } diff --git a/api/datadogV2/model_mute_finding_request_data.go b/api/datadogV2/model_mute_finding_request_data.go index 280e2fb0453..d6858c7751c 100644 --- a/api/datadogV2/model_mute_finding_request_data.go +++ b/api/datadogV2/model_mute_finding_request_data.go @@ -134,31 +134,12 @@ func (o MuteFindingRequestData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequestData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *MuteFindingRequestAttributes `json:"attributes"` Id *string `json:"id"` Type *FindingType `json:"type"` }{} - all := struct { - Attributes MuteFindingRequestAttributes `json:"attributes"` - Id string `json:"id"` - Type FindingType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *MuteFindingRequestData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *MuteFindingRequestData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_mute_finding_request_properties.go b/api/datadogV2/model_mute_finding_request_properties.go index 53d6fafcafd..2f705471cf6 100644 --- a/api/datadogV2/model_mute_finding_request_properties.go +++ b/api/datadogV2/model_mute_finding_request_properties.go @@ -166,28 +166,13 @@ func (o MuteFindingRequestProperties) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingRequestProperties) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Muted *bool `json:"muted"` - Reason *FindingMuteReason `json:"reason"` - }{} all := struct { - Description *string `json:"description,omitempty"` - ExpirationDate *int64 `json:"expiration_date,omitempty"` - Muted bool `json:"muted"` - Reason FindingMuteReason `json:"reason"` + Description *string `json:"description,omitempty"` + ExpirationDate *int64 `json:"expiration_date,omitempty"` + Muted *bool `json:"muted"` + Reason *FindingMuteReason `json:"reason"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Muted == nil { - return fmt.Errorf("required field muted missing") - } - if required.Reason == nil { - return fmt.Errorf("required field reason missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -195,6 +180,12 @@ func (o *MuteFindingRequestProperties) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Muted == nil { + return fmt.Errorf("required field muted missing") + } + if all.Reason == nil { + return fmt.Errorf("required field reason missing") + } if v := all.Reason; !v.IsValid() { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -205,8 +196,8 @@ func (o *MuteFindingRequestProperties) UnmarshalJSON(bytes []byte) (err error) { } o.Description = all.Description o.ExpirationDate = all.ExpirationDate - o.Muted = all.Muted - o.Reason = all.Reason + o.Muted = *all.Muted + o.Reason = *all.Reason return nil } diff --git a/api/datadogV2/model_mute_finding_response.go b/api/datadogV2/model_mute_finding_response.go index 8ab4e7f63ff..f61637563da 100644 --- a/api/datadogV2/model_mute_finding_response.go +++ b/api/datadogV2/model_mute_finding_response.go @@ -78,21 +78,10 @@ func (o MuteFindingResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *MuteFindingResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *MuteFindingResponseData `json:"data"` - }{} all := struct { - Data MuteFindingResponseData `json:"data"` + Data *MuteFindingResponseData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *MuteFindingResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *MuteFindingResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_mute_finding_response_attributes.go b/api/datadogV2/model_mute_finding_response_attributes.go index ec6fceefce2..9b7191141b7 100644 --- a/api/datadogV2/model_mute_finding_response_attributes.go +++ b/api/datadogV2/model_mute_finding_response_attributes.go @@ -358,8 +358,7 @@ func (o *MuteFindingResponseAttributes) UnmarshalJSON(bytes []byte) (err error) Status *FindingStatus `json:"status,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_mute_finding_response_data.go b/api/datadogV2/model_mute_finding_response_data.go index 78c813b493b..cc014bc2396 100644 --- a/api/datadogV2/model_mute_finding_response_data.go +++ b/api/datadogV2/model_mute_finding_response_data.go @@ -158,8 +158,7 @@ func (o *MuteFindingResponseData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *FindingType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_mute_finding_response_properties.go b/api/datadogV2/model_mute_finding_response_properties.go index 4c40e9f9426..780d7ebf5b8 100644 --- a/api/datadogV2/model_mute_finding_response_properties.go +++ b/api/datadogV2/model_mute_finding_response_properties.go @@ -185,8 +185,7 @@ func (o *MuteFindingResponseProperties) UnmarshalJSON(bytes []byte) (err error) Muted *bool `json:"muted,omitempty"` Reason *FindingMuteReason `json:"reason,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_nullable_relationship_to_user.go b/api/datadogV2/model_nullable_relationship_to_user.go index 0abb1835260..0dc9d16989f 100644 --- a/api/datadogV2/model_nullable_relationship_to_user.go +++ b/api/datadogV2/model_nullable_relationship_to_user.go @@ -80,21 +80,10 @@ func (o NullableRelationshipToUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NullableRelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data NullableNullableRelationshipToUserData `json:"data"` - }{} all := struct { Data NullableNullableRelationshipToUserData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if !required.Data.IsSet() { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -102,6 +91,9 @@ func (o *NullableRelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if !all.Data.IsSet() { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) diff --git a/api/datadogV2/model_nullable_relationship_to_user_data.go b/api/datadogV2/model_nullable_relationship_to_user_data.go index 987a0f7311c..a92edad305d 100644 --- a/api/datadogV2/model_nullable_relationship_to_user_data.go +++ b/api/datadogV2/model_nullable_relationship_to_user_data.go @@ -107,26 +107,11 @@ func (o NullableRelationshipToUserData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *UsersType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *NullableRelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_on_demand_concurrency_cap.go b/api/datadogV2/model_on_demand_concurrency_cap.go index 9a776a02f09..03b32a9f731 100644 --- a/api/datadogV2/model_on_demand_concurrency_cap.go +++ b/api/datadogV2/model_on_demand_concurrency_cap.go @@ -86,8 +86,7 @@ func (o *OnDemandConcurrencyCap) UnmarshalJSON(bytes []byte) (err error) { all := struct { Attributes *OnDemandConcurrencyCapAttributes `json:"attributes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_on_demand_concurrency_cap_attributes.go b/api/datadogV2/model_on_demand_concurrency_cap_attributes.go index 50832443100..e21e5068512 100644 --- a/api/datadogV2/model_on_demand_concurrency_cap_attributes.go +++ b/api/datadogV2/model_on_demand_concurrency_cap_attributes.go @@ -86,8 +86,7 @@ func (o *OnDemandConcurrencyCapAttributes) UnmarshalJSON(bytes []byte) (err erro all := struct { OnDemandConcurrencyCap *float64 `json:"on_demand_concurrency_cap,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_on_demand_concurrency_cap_response.go b/api/datadogV2/model_on_demand_concurrency_cap_response.go index 9a25247fdab..31dfe77f740 100644 --- a/api/datadogV2/model_on_demand_concurrency_cap_response.go +++ b/api/datadogV2/model_on_demand_concurrency_cap_response.go @@ -86,8 +86,7 @@ func (o *OnDemandConcurrencyCapResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data *OnDemandConcurrencyCap `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_opsgenie_service_create_attributes.go b/api/datadogV2/model_opsgenie_service_create_attributes.go index 5ed36802cee..7a2114a25e4 100644 --- a/api/datadogV2/model_opsgenie_service_create_attributes.go +++ b/api/datadogV2/model_opsgenie_service_create_attributes.go @@ -165,32 +165,13 @@ func (o OpsgenieServiceCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { + CustomUrl *string `json:"custom_url,omitempty"` Name *string `json:"name"` OpsgenieApiKey *string `json:"opsgenie_api_key"` Region *OpsgenieServiceRegionType `json:"region"` }{} - all := struct { - CustomUrl *string `json:"custom_url,omitempty"` - Name string `json:"name"` - OpsgenieApiKey string `json:"opsgenie_api_key"` - Region OpsgenieServiceRegionType `json:"region"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.OpsgenieApiKey == nil { - return fmt.Errorf("required field opsgenie_api_key missing") - } - if required.Region == nil { - return fmt.Errorf("required field region missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,6 +179,15 @@ func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.OpsgenieApiKey == nil { + return fmt.Errorf("required field opsgenie_api_key missing") + } + if all.Region == nil { + return fmt.Errorf("required field region missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"custom_url", "name", "opsgenie_api_key", "region"}) @@ -213,9 +203,9 @@ func (o *OpsgenieServiceCreateAttributes) UnmarshalJSON(bytes []byte) (err error return nil } o.CustomUrl = all.CustomUrl - o.Name = all.Name - o.OpsgenieApiKey = all.OpsgenieApiKey - o.Region = all.Region + o.Name = *all.Name + o.OpsgenieApiKey = *all.OpsgenieApiKey + o.Region = *all.Region if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_service_create_data.go b/api/datadogV2/model_opsgenie_service_create_data.go index 23e473dad87..0298348dd82 100644 --- a/api/datadogV2/model_opsgenie_service_create_data.go +++ b/api/datadogV2/model_opsgenie_service_create_data.go @@ -107,26 +107,11 @@ func (o OpsgenieServiceCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *OpsgenieServiceCreateAttributes `json:"attributes"` Type *OpsgenieServiceType `json:"type"` }{} - all := struct { - Attributes OpsgenieServiceCreateAttributes `json:"attributes"` - Type OpsgenieServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *OpsgenieServiceCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_service_create_request.go b/api/datadogV2/model_opsgenie_service_create_request.go index 4813867f9be..3a71db18e9a 100644 --- a/api/datadogV2/model_opsgenie_service_create_request.go +++ b/api/datadogV2/model_opsgenie_service_create_request.go @@ -78,21 +78,10 @@ func (o OpsgenieServiceCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *OpsgenieServiceCreateData `json:"data"` - }{} all := struct { - Data OpsgenieServiceCreateData `json:"data"` + Data *OpsgenieServiceCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *OpsgenieServiceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_service_response.go b/api/datadogV2/model_opsgenie_service_response.go index 2f248781d80..142124e3e20 100644 --- a/api/datadogV2/model_opsgenie_service_response.go +++ b/api/datadogV2/model_opsgenie_service_response.go @@ -78,21 +78,10 @@ func (o OpsgenieServiceResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *OpsgenieServiceResponseData `json:"data"` - }{} all := struct { - Data OpsgenieServiceResponseData `json:"data"` + Data *OpsgenieServiceResponseData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *OpsgenieServiceResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_service_response_attributes.go b/api/datadogV2/model_opsgenie_service_response_attributes.go index f5ddaabfb7d..106510d7536 100644 --- a/api/datadogV2/model_opsgenie_service_response_attributes.go +++ b/api/datadogV2/model_opsgenie_service_response_attributes.go @@ -165,8 +165,7 @@ func (o *OpsgenieServiceResponseAttributes) UnmarshalJSON(bytes []byte) (err err Name *string `json:"name,omitempty"` Region *OpsgenieServiceRegionType `json:"region,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_opsgenie_service_response_data.go b/api/datadogV2/model_opsgenie_service_response_data.go index c1d0f46962e..63af45dfc15 100644 --- a/api/datadogV2/model_opsgenie_service_response_data.go +++ b/api/datadogV2/model_opsgenie_service_response_data.go @@ -134,31 +134,12 @@ func (o OpsgenieServiceResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *OpsgenieServiceResponseAttributes `json:"attributes"` Id *string `json:"id"` Type *OpsgenieServiceType `json:"type"` }{} - all := struct { - Attributes OpsgenieServiceResponseAttributes `json:"attributes"` - Id string `json:"id"` - Type OpsgenieServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *OpsgenieServiceResponseData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_service_update_attributes.go b/api/datadogV2/model_opsgenie_service_update_attributes.go index f4d992f4be8..464c28d227d 100644 --- a/api/datadogV2/model_opsgenie_service_update_attributes.go +++ b/api/datadogV2/model_opsgenie_service_update_attributes.go @@ -199,8 +199,7 @@ func (o *OpsgenieServiceUpdateAttributes) UnmarshalJSON(bytes []byte) (err error OpsgenieApiKey *string `json:"opsgenie_api_key,omitempty"` Region *OpsgenieServiceRegionType `json:"region,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_opsgenie_service_update_data.go b/api/datadogV2/model_opsgenie_service_update_data.go index 0b1eb8e989f..6e08b78d1c0 100644 --- a/api/datadogV2/model_opsgenie_service_update_data.go +++ b/api/datadogV2/model_opsgenie_service_update_data.go @@ -134,31 +134,12 @@ func (o OpsgenieServiceUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *OpsgenieServiceUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *OpsgenieServiceType `json:"type"` }{} - all := struct { - Attributes OpsgenieServiceUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type OpsgenieServiceType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *OpsgenieServiceUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_service_update_request.go b/api/datadogV2/model_opsgenie_service_update_request.go index b105cd465c4..6654eed2e5f 100644 --- a/api/datadogV2/model_opsgenie_service_update_request.go +++ b/api/datadogV2/model_opsgenie_service_update_request.go @@ -78,21 +78,10 @@ func (o OpsgenieServiceUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *OpsgenieServiceUpdateData `json:"data"` - }{} all := struct { - Data OpsgenieServiceUpdateData `json:"data"` + Data *OpsgenieServiceUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *OpsgenieServiceUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_opsgenie_services_response.go b/api/datadogV2/model_opsgenie_services_response.go index 5cc3ffe5237..79ca1ff298e 100644 --- a/api/datadogV2/model_opsgenie_services_response.go +++ b/api/datadogV2/model_opsgenie_services_response.go @@ -78,21 +78,10 @@ func (o OpsgenieServicesResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *OpsgenieServicesResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]OpsgenieServiceResponseData `json:"data"` - }{} all := struct { - Data []OpsgenieServiceResponseData `json:"data"` + Data *[]OpsgenieServiceResponseData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *OpsgenieServicesResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_organization.go b/api/datadogV2/model_organization.go index fadc5ec53cf..fe86af89f39 100644 --- a/api/datadogV2/model_organization.go +++ b/api/datadogV2/model_organization.go @@ -146,23 +146,12 @@ func (o Organization) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *OrganizationsType `json:"type"` - }{} all := struct { Attributes *OrganizationAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` - Type OrganizationsType `json:"type"` + Type *OrganizationsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -193,7 +185,7 @@ func (o *Organization) UnmarshalJSON(bytes []byte) (err error) { } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_organization_attributes.go b/api/datadogV2/model_organization_attributes.go index 27fbcfc3458..022247a715d 100644 --- a/api/datadogV2/model_organization_attributes.go +++ b/api/datadogV2/model_organization_attributes.go @@ -333,8 +333,7 @@ func (o *OrganizationAttributes) UnmarshalJSON(bytes []byte) (err error) { Sharing *string `json:"sharing,omitempty"` Url *string `json:"url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_pagination.go b/api/datadogV2/model_pagination.go index de2e093e221..0034eecf13e 100644 --- a/api/datadogV2/model_pagination.go +++ b/api/datadogV2/model_pagination.go @@ -120,8 +120,7 @@ func (o *Pagination) UnmarshalJSON(bytes []byte) (err error) { TotalCount *int64 `json:"total_count,omitempty"` TotalFilteredCount *int64 `json:"total_filtered_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_partial_api_key.go b/api/datadogV2/model_partial_api_key.go index bee720f2329..f66d8664fa7 100644 --- a/api/datadogV2/model_partial_api_key.go +++ b/api/datadogV2/model_partial_api_key.go @@ -192,8 +192,7 @@ func (o *PartialAPIKey) UnmarshalJSON(bytes []byte) (err error) { Relationships *APIKeyRelationships `json:"relationships,omitempty"` Type *APIKeysType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_partial_api_key_attributes.go b/api/datadogV2/model_partial_api_key_attributes.go index d54aefe642b..2730a4708b3 100644 --- a/api/datadogV2/model_partial_api_key_attributes.go +++ b/api/datadogV2/model_partial_api_key_attributes.go @@ -188,8 +188,7 @@ func (o *PartialAPIKeyAttributes) UnmarshalJSON(bytes []byte) (err error) { ModifiedAt *string `json:"modified_at,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_partial_application_key.go b/api/datadogV2/model_partial_application_key.go index 4a6788f8126..a0bc9f8821b 100644 --- a/api/datadogV2/model_partial_application_key.go +++ b/api/datadogV2/model_partial_application_key.go @@ -192,8 +192,7 @@ func (o *PartialApplicationKey) UnmarshalJSON(bytes []byte) (err error) { Relationships *ApplicationKeyRelationships `json:"relationships,omitempty"` Type *ApplicationKeysType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_partial_application_key_attributes.go b/api/datadogV2/model_partial_application_key_attributes.go index 3b464a43f0e..c8abdf95133 100644 --- a/api/datadogV2/model_partial_application_key_attributes.go +++ b/api/datadogV2/model_partial_application_key_attributes.go @@ -199,8 +199,7 @@ func (o *PartialApplicationKeyAttributes) UnmarshalJSON(bytes []byte) (err error Name *string `json:"name,omitempty"` Scopes datadog.NullableList[string] `json:"scopes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_partial_application_key_response.go b/api/datadogV2/model_partial_application_key_response.go index 6fafcfefbec..fa1a690fd5a 100644 --- a/api/datadogV2/model_partial_application_key_response.go +++ b/api/datadogV2/model_partial_application_key_response.go @@ -120,8 +120,7 @@ func (o *PartialApplicationKeyResponse) UnmarshalJSON(bytes []byte) (err error) Data *PartialApplicationKey `json:"data,omitempty"` Included []ApplicationKeyResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_permission.go b/api/datadogV2/model_permission.go index 78565def790..a3c745b3703 100644 --- a/api/datadogV2/model_permission.go +++ b/api/datadogV2/model_permission.go @@ -146,23 +146,12 @@ func (o Permission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *PermissionsType `json:"type"` - }{} all := struct { Attributes *PermissionAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` - Type PermissionsType `json:"type"` + Type *PermissionsType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -193,7 +185,7 @@ func (o *Permission) UnmarshalJSON(bytes []byte) (err error) { } o.Attributes = all.Attributes o.Id = all.Id - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_permission_attributes.go b/api/datadogV2/model_permission_attributes.go index 13316b7673b..7712fa70241 100644 --- a/api/datadogV2/model_permission_attributes.go +++ b/api/datadogV2/model_permission_attributes.go @@ -295,8 +295,7 @@ func (o *PermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` Restricted *bool `json:"restricted,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_permissions_response.go b/api/datadogV2/model_permissions_response.go index 41b5766b371..ebfd786a10d 100644 --- a/api/datadogV2/model_permissions_response.go +++ b/api/datadogV2/model_permissions_response.go @@ -86,8 +86,7 @@ func (o *PermissionsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []Permission `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_process_summaries_meta.go b/api/datadogV2/model_process_summaries_meta.go index 9ce6fbdeaf9..956ff6b6399 100644 --- a/api/datadogV2/model_process_summaries_meta.go +++ b/api/datadogV2/model_process_summaries_meta.go @@ -86,8 +86,7 @@ func (o *ProcessSummariesMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *ProcessSummariesMetaPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_process_summaries_meta_page.go b/api/datadogV2/model_process_summaries_meta_page.go index 37c929ddc19..2e0c71a456f 100644 --- a/api/datadogV2/model_process_summaries_meta_page.go +++ b/api/datadogV2/model_process_summaries_meta_page.go @@ -121,8 +121,7 @@ func (o *ProcessSummariesMetaPage) UnmarshalJSON(bytes []byte) (err error) { After *string `json:"after,omitempty"` Size *int32 `json:"size,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_process_summaries_response.go b/api/datadogV2/model_process_summaries_response.go index 4213c00ff3e..c371bbed8f5 100644 --- a/api/datadogV2/model_process_summaries_response.go +++ b/api/datadogV2/model_process_summaries_response.go @@ -120,8 +120,7 @@ func (o *ProcessSummariesResponse) UnmarshalJSON(bytes []byte) (err error) { Data []ProcessSummary `json:"data,omitempty"` Meta *ProcessSummariesMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_process_summary.go b/api/datadogV2/model_process_summary.go index 43057ba1f6c..45417726705 100644 --- a/api/datadogV2/model_process_summary.go +++ b/api/datadogV2/model_process_summary.go @@ -158,8 +158,7 @@ func (o *ProcessSummary) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *ProcessSummaryType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_process_summary_attributes.go b/api/datadogV2/model_process_summary_attributes.go index 631e15cb0f2..1bf0e7fd28d 100644 --- a/api/datadogV2/model_process_summary_attributes.go +++ b/api/datadogV2/model_process_summary_attributes.go @@ -324,8 +324,7 @@ func (o *ProcessSummaryAttributes) UnmarshalJSON(bytes []byte) (err error) { Timestamp *string `json:"timestamp,omitempty"` User *string `json:"user,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_query_formula.go b/api/datadogV2/model_query_formula.go index ff00463580c..3e249f2791f 100644 --- a/api/datadogV2/model_query_formula.go +++ b/api/datadogV2/model_query_formula.go @@ -111,22 +111,11 @@ func (o QueryFormula) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *QueryFormula) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Formula *string `json:"formula"` - }{} all := struct { - Formula string `json:"formula"` + Formula *string `json:"formula"` Limit *FormulaLimit `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Formula == nil { - return fmt.Errorf("required field formula missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *QueryFormula) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Formula == nil { + return fmt.Errorf("required field formula missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"formula", "limit"}) } else { return err } - o.Formula = all.Formula + o.Formula = *all.Formula if all.Limit != nil && all.Limit.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_relationship_to_incident_attachment.go b/api/datadogV2/model_relationship_to_incident_attachment.go index 74756a9578c..79f204768c6 100644 --- a/api/datadogV2/model_relationship_to_incident_attachment.go +++ b/api/datadogV2/model_relationship_to_incident_attachment.go @@ -78,21 +78,10 @@ func (o RelationshipToIncidentAttachment) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentAttachment) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToIncidentAttachmentData `json:"data"` - }{} all := struct { - Data []RelationshipToIncidentAttachmentData `json:"data"` + Data *[]RelationshipToIncidentAttachmentData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *RelationshipToIncidentAttachment) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_incident_attachment_data.go b/api/datadogV2/model_relationship_to_incident_attachment_data.go index f3bf3eafa2b..bc22c7bc08d 100644 --- a/api/datadogV2/model_relationship_to_incident_attachment_data.go +++ b/api/datadogV2/model_relationship_to_incident_attachment_data.go @@ -107,26 +107,11 @@ func (o RelationshipToIncidentAttachmentData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentAttachmentData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *IncidentAttachmentType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type IncidentAttachmentType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToIncidentAttachmentData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToIncidentAttachmentData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go b/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go index 5708ed52015..a6ae6c47c19 100644 --- a/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go +++ b/api/datadogV2/model_relationship_to_incident_integration_metadata_data.go @@ -107,26 +107,11 @@ func (o RelationshipToIncidentIntegrationMetadataData) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *IncidentIntegrationMetadataType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type IncidentIntegrationMetadataType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToIncidentIntegrationMetadataData) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_incident_integration_metadatas.go b/api/datadogV2/model_relationship_to_incident_integration_metadatas.go index 88b88e1c25a..f4abe6480ef 100644 --- a/api/datadogV2/model_relationship_to_incident_integration_metadatas.go +++ b/api/datadogV2/model_relationship_to_incident_integration_metadatas.go @@ -78,21 +78,10 @@ func (o RelationshipToIncidentIntegrationMetadatas) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentIntegrationMetadatas) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToIncidentIntegrationMetadataData `json:"data"` - }{} all := struct { - Data []RelationshipToIncidentIntegrationMetadataData `json:"data"` + Data *[]RelationshipToIncidentIntegrationMetadataData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *RelationshipToIncidentIntegrationMetadatas) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_incident_postmortem.go b/api/datadogV2/model_relationship_to_incident_postmortem.go index 523716eb6d4..1add15aefd1 100644 --- a/api/datadogV2/model_relationship_to_incident_postmortem.go +++ b/api/datadogV2/model_relationship_to_incident_postmortem.go @@ -78,21 +78,10 @@ func (o RelationshipToIncidentPostmortem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RelationshipToIncidentPostmortemData `json:"data"` - }{} all := struct { - Data RelationshipToIncidentPostmortemData `json:"data"` + Data *RelationshipToIncidentPostmortemData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RelationshipToIncidentPostmortem) UnmarshalJSON(bytes []byte) (err erro } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_incident_postmortem_data.go b/api/datadogV2/model_relationship_to_incident_postmortem_data.go index 656c0fb98b4..f6dabb35f92 100644 --- a/api/datadogV2/model_relationship_to_incident_postmortem_data.go +++ b/api/datadogV2/model_relationship_to_incident_postmortem_data.go @@ -107,26 +107,11 @@ func (o RelationshipToIncidentPostmortemData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *IncidentPostmortemType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type IncidentPostmortemType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToIncidentPostmortemData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_organization.go b/api/datadogV2/model_relationship_to_organization.go index 9fbf081e313..87cbddcb06a 100644 --- a/api/datadogV2/model_relationship_to_organization.go +++ b/api/datadogV2/model_relationship_to_organization.go @@ -78,21 +78,10 @@ func (o RelationshipToOrganization) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RelationshipToOrganizationData `json:"data"` - }{} all := struct { - Data RelationshipToOrganizationData `json:"data"` + Data *RelationshipToOrganizationData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RelationshipToOrganization) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_organization_data.go b/api/datadogV2/model_relationship_to_organization_data.go index dbf3248e872..332578b1e13 100644 --- a/api/datadogV2/model_relationship_to_organization_data.go +++ b/api/datadogV2/model_relationship_to_organization_data.go @@ -107,26 +107,11 @@ func (o RelationshipToOrganizationData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *OrganizationsType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type OrganizationsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToOrganizationData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_organizations.go b/api/datadogV2/model_relationship_to_organizations.go index 82bb1774599..1b4a821cbd4 100644 --- a/api/datadogV2/model_relationship_to_organizations.go +++ b/api/datadogV2/model_relationship_to_organizations.go @@ -78,21 +78,10 @@ func (o RelationshipToOrganizations) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToOrganizations) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToOrganizationData `json:"data"` - }{} all := struct { - Data []RelationshipToOrganizationData `json:"data"` + Data *[]RelationshipToOrganizationData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *RelationshipToOrganizations) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_permission.go b/api/datadogV2/model_relationship_to_permission.go index 8da6c521a36..eaeb575dca5 100644 --- a/api/datadogV2/model_relationship_to_permission.go +++ b/api/datadogV2/model_relationship_to_permission.go @@ -86,8 +86,7 @@ func (o *RelationshipToPermission) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *RelationshipToPermissionData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_permission_data.go b/api/datadogV2/model_relationship_to_permission_data.go index 2226259992f..09c7d672219 100644 --- a/api/datadogV2/model_relationship_to_permission_data.go +++ b/api/datadogV2/model_relationship_to_permission_data.go @@ -124,8 +124,7 @@ func (o *RelationshipToPermissionData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *PermissionsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_permissions.go b/api/datadogV2/model_relationship_to_permissions.go index 7061a9ad5b5..7dba0d65172 100644 --- a/api/datadogV2/model_relationship_to_permissions.go +++ b/api/datadogV2/model_relationship_to_permissions.go @@ -86,8 +86,7 @@ func (o *RelationshipToPermissions) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []RelationshipToPermissionData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_role.go b/api/datadogV2/model_relationship_to_role.go index f0e82c2077b..baa8c92ad2a 100644 --- a/api/datadogV2/model_relationship_to_role.go +++ b/api/datadogV2/model_relationship_to_role.go @@ -86,8 +86,7 @@ func (o *RelationshipToRole) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *RelationshipToRoleData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_role_data.go b/api/datadogV2/model_relationship_to_role_data.go index 0b82b599f49..4043b8422c0 100644 --- a/api/datadogV2/model_relationship_to_role_data.go +++ b/api/datadogV2/model_relationship_to_role_data.go @@ -124,8 +124,7 @@ func (o *RelationshipToRoleData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *RolesType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_roles.go b/api/datadogV2/model_relationship_to_roles.go index e6b18002d03..d9d9f90458e 100644 --- a/api/datadogV2/model_relationship_to_roles.go +++ b/api/datadogV2/model_relationship_to_roles.go @@ -86,8 +86,7 @@ func (o *RelationshipToRoles) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []RelationshipToRoleData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_saml_assertion_attribute.go b/api/datadogV2/model_relationship_to_saml_assertion_attribute.go index 25842cc6fb3..b5240af3cd4 100644 --- a/api/datadogV2/model_relationship_to_saml_assertion_attribute.go +++ b/api/datadogV2/model_relationship_to_saml_assertion_attribute.go @@ -78,21 +78,10 @@ func (o RelationshipToSAMLAssertionAttribute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RelationshipToSAMLAssertionAttributeData `json:"data"` - }{} all := struct { - Data RelationshipToSAMLAssertionAttributeData `json:"data"` + Data *RelationshipToSAMLAssertionAttributeData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RelationshipToSAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go b/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go index ac675c2e525..a1c9669399b 100644 --- a/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go +++ b/api/datadogV2/model_relationship_to_saml_assertion_attribute_data.go @@ -107,26 +107,11 @@ func (o RelationshipToSAMLAssertionAttributeData) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *SAMLAssertionAttributesType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type SAMLAssertionAttributesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToSAMLAssertionAttributeData) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_team_link_data.go b/api/datadogV2/model_relationship_to_team_link_data.go index 1d2d806bdfc..e9d784a99f1 100644 --- a/api/datadogV2/model_relationship_to_team_link_data.go +++ b/api/datadogV2/model_relationship_to_team_link_data.go @@ -107,26 +107,11 @@ func (o RelationshipToTeamLinkData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToTeamLinkData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *TeamLinkType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type TeamLinkType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToTeamLinkData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToTeamLinkData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_team_links.go b/api/datadogV2/model_relationship_to_team_links.go index b0f05edad9c..3ead00fea9a 100644 --- a/api/datadogV2/model_relationship_to_team_links.go +++ b/api/datadogV2/model_relationship_to_team_links.go @@ -86,8 +86,7 @@ func (o *RelationshipToTeamLinks) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []RelationshipToTeamLinkData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_user.go b/api/datadogV2/model_relationship_to_user.go index b3104fcc69a..30f733ee89c 100644 --- a/api/datadogV2/model_relationship_to_user.go +++ b/api/datadogV2/model_relationship_to_user.go @@ -78,21 +78,10 @@ func (o RelationshipToUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RelationshipToUserData `json:"data"` - }{} all := struct { - Data RelationshipToUserData `json:"data"` + Data *RelationshipToUserData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RelationshipToUser) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_user_data.go b/api/datadogV2/model_relationship_to_user_data.go index e6860f119bd..c42f180fe74 100644 --- a/api/datadogV2/model_relationship_to_user_data.go +++ b/api/datadogV2/model_relationship_to_user_data.go @@ -107,26 +107,11 @@ func (o RelationshipToUserData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *UsersType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToUserData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_user_team_permission.go b/api/datadogV2/model_relationship_to_user_team_permission.go index 509a00b3c7c..c3b4942b203 100644 --- a/api/datadogV2/model_relationship_to_user_team_permission.go +++ b/api/datadogV2/model_relationship_to_user_team_permission.go @@ -86,8 +86,7 @@ func (o *RelationshipToUserTeamPermission) UnmarshalJSON(bytes []byte) (err erro all := struct { Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_relationship_to_user_team_permission_data.go b/api/datadogV2/model_relationship_to_user_team_permission_data.go index 7bad745a6d8..707c8afffde 100644 --- a/api/datadogV2/model_relationship_to_user_team_permission_data.go +++ b/api/datadogV2/model_relationship_to_user_team_permission_data.go @@ -107,26 +107,11 @@ func (o RelationshipToUserTeamPermissionData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *UserTeamPermissionType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type UserTeamPermissionType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_user_team_user.go b/api/datadogV2/model_relationship_to_user_team_user.go index c63581d512a..3444c860ec7 100644 --- a/api/datadogV2/model_relationship_to_user_team_user.go +++ b/api/datadogV2/model_relationship_to_user_team_user.go @@ -78,21 +78,10 @@ func (o RelationshipToUserTeamUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamUser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RelationshipToUserTeamUserData `json:"data"` - }{} all := struct { - Data RelationshipToUserTeamUserData `json:"data"` + Data *RelationshipToUserTeamUserData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RelationshipToUserTeamUser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RelationshipToUserTeamUser) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_user_team_user_data.go b/api/datadogV2/model_relationship_to_user_team_user_data.go index 655abd885ee..079215bb354 100644 --- a/api/datadogV2/model_relationship_to_user_team_user_data.go +++ b/api/datadogV2/model_relationship_to_user_team_user_data.go @@ -107,26 +107,11 @@ func (o RelationshipToUserTeamUserData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamUserData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Id *string `json:"id"` Type *UserTeamUserType `json:"type"` }{} - all := struct { - Id string `json:"id"` - Type UserTeamUserType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RelationshipToUserTeamUserData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) @@ -148,8 +139,8 @@ func (o *RelationshipToUserTeamUserData) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_relationship_to_users.go b/api/datadogV2/model_relationship_to_users.go index 9dc30898b7e..1864a1d1b8d 100644 --- a/api/datadogV2/model_relationship_to_users.go +++ b/api/datadogV2/model_relationship_to_users.go @@ -78,21 +78,10 @@ func (o RelationshipToUsers) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUsers) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]RelationshipToUserData `json:"data"` - }{} all := struct { - Data []RelationshipToUserData `json:"data"` + Data *[]RelationshipToUserData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *RelationshipToUsers) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_response_meta_attributes.go b/api/datadogV2/model_response_meta_attributes.go index 3503ece9aa4..dbec9d58110 100644 --- a/api/datadogV2/model_response_meta_attributes.go +++ b/api/datadogV2/model_response_meta_attributes.go @@ -86,8 +86,7 @@ func (o *ResponseMetaAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { Page *Pagination `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_restriction_policy.go b/api/datadogV2/model_restriction_policy.go index 18e24822e99..0a9fcdef97c 100644 --- a/api/datadogV2/model_restriction_policy.go +++ b/api/datadogV2/model_restriction_policy.go @@ -134,31 +134,12 @@ func (o RestrictionPolicy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *RestrictionPolicyAttributes `json:"attributes"` Id *string `json:"id"` Type *RestrictionPolicyType `json:"type"` }{} - all := struct { - Attributes RestrictionPolicyAttributes `json:"attributes"` - Id string `json:"id"` - Type RestrictionPolicyType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *RestrictionPolicy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *RestrictionPolicy) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_restriction_policy_attributes.go b/api/datadogV2/model_restriction_policy_attributes.go index f2044e4e0e1..c7b8bd2e363 100644 --- a/api/datadogV2/model_restriction_policy_attributes.go +++ b/api/datadogV2/model_restriction_policy_attributes.go @@ -78,21 +78,10 @@ func (o RestrictionPolicyAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Bindings *[]RestrictionPolicyBinding `json:"bindings"` - }{} all := struct { - Bindings []RestrictionPolicyBinding `json:"bindings"` + Bindings *[]RestrictionPolicyBinding `json:"bindings"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Bindings == nil { - return fmt.Errorf("required field bindings missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *RestrictionPolicyAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Bindings == nil { + return fmt.Errorf("required field bindings missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"bindings"}) } else { return err } - o.Bindings = all.Bindings + o.Bindings = *all.Bindings if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_restriction_policy_binding.go b/api/datadogV2/model_restriction_policy_binding.go index ec4b4f9dec5..4534b823f43 100644 --- a/api/datadogV2/model_restriction_policy_binding.go +++ b/api/datadogV2/model_restriction_policy_binding.go @@ -107,26 +107,11 @@ func (o RestrictionPolicyBinding) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyBinding) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Principals *[]string `json:"principals"` Relation *string `json:"relation"` }{} - all := struct { - Principals []string `json:"principals"` - Relation string `json:"relation"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Principals == nil { - return fmt.Errorf("required field principals missing") - } - if required.Relation == nil { - return fmt.Errorf("required field relation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,14 +119,20 @@ func (o *RestrictionPolicyBinding) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Principals == nil { + return fmt.Errorf("required field principals missing") + } + if all.Relation == nil { + return fmt.Errorf("required field relation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"principals", "relation"}) } else { return err } - o.Principals = all.Principals - o.Relation = all.Relation + o.Principals = *all.Principals + o.Relation = *all.Relation if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_restriction_policy_response.go b/api/datadogV2/model_restriction_policy_response.go index 7c3739d6360..cc1255c9b18 100644 --- a/api/datadogV2/model_restriction_policy_response.go +++ b/api/datadogV2/model_restriction_policy_response.go @@ -78,21 +78,10 @@ func (o RestrictionPolicyResponse) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RestrictionPolicy `json:"data"` - }{} all := struct { - Data RestrictionPolicy `json:"data"` + Data *RestrictionPolicy `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RestrictionPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RestrictionPolicyResponse) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_restriction_policy_update_request.go b/api/datadogV2/model_restriction_policy_update_request.go index d59367917be..cdc65bb4283 100644 --- a/api/datadogV2/model_restriction_policy_update_request.go +++ b/api/datadogV2/model_restriction_policy_update_request.go @@ -78,21 +78,10 @@ func (o RestrictionPolicyUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RestrictionPolicyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RestrictionPolicy `json:"data"` - }{} all := struct { - Data RestrictionPolicy `json:"data"` + Data *RestrictionPolicy `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RestrictionPolicyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RestrictionPolicyUpdateRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role.go b/api/datadogV2/model_role.go index 39f11d69173..02d44481f1e 100644 --- a/api/datadogV2/model_role.go +++ b/api/datadogV2/model_role.go @@ -179,24 +179,13 @@ func (o Role) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Role) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *RolesType `json:"type"` - }{} all := struct { Attributes *RoleAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` + Type *RolesType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -204,6 +193,9 @@ func (o *Role) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -235,7 +227,7 @@ func (o *Role) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_attributes.go b/api/datadogV2/model_role_attributes.go index f4a250749d3..cb353b9199a 100644 --- a/api/datadogV2/model_role_attributes.go +++ b/api/datadogV2/model_role_attributes.go @@ -197,8 +197,7 @@ func (o *RoleAttributes) UnmarshalJSON(bytes []byte) (err error) { Name *string `json:"name,omitempty"` UserCount *int64 `json:"user_count,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_clone.go b/api/datadogV2/model_role_clone.go index da1bf3c0dc2..88fb6d64fdc 100644 --- a/api/datadogV2/model_role_clone.go +++ b/api/datadogV2/model_role_clone.go @@ -107,26 +107,11 @@ func (o RoleClone) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *RoleCloneAttributes `json:"attributes"` Type *RolesType `json:"type"` }{} - all := struct { - Attributes RoleCloneAttributes `json:"attributes"` - Type RolesType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *RoleClone) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_clone_attributes.go b/api/datadogV2/model_role_clone_attributes.go index b49f46c5c04..c087c4e902e 100644 --- a/api/datadogV2/model_role_clone_attributes.go +++ b/api/datadogV2/model_role_clone_attributes.go @@ -78,21 +78,10 @@ func (o RoleCloneAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *RoleCloneAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_clone_request.go b/api/datadogV2/model_role_clone_request.go index 7350c351131..88d913b054d 100644 --- a/api/datadogV2/model_role_clone_request.go +++ b/api/datadogV2/model_role_clone_request.go @@ -78,21 +78,10 @@ func (o RoleCloneRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RoleClone `json:"data"` - }{} all := struct { - Data RoleClone `json:"data"` + Data *RoleClone `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RoleCloneRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_create_attributes.go b/api/datadogV2/model_role_create_attributes.go index 3a286712429..95d827bf20a 100644 --- a/api/datadogV2/model_role_create_attributes.go +++ b/api/datadogV2/model_role_create_attributes.go @@ -153,23 +153,12 @@ func (o RoleCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -177,6 +166,9 @@ func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name"}) @@ -185,7 +177,7 @@ func (o *RoleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.CreatedAt = all.CreatedAt o.ModifiedAt = all.ModifiedAt - o.Name = all.Name + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_create_data.go b/api/datadogV2/model_role_create_data.go index f66f4c4707c..13b9ed6de97 100644 --- a/api/datadogV2/model_role_create_data.go +++ b/api/datadogV2/model_role_create_data.go @@ -148,23 +148,12 @@ func (o RoleCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *RoleCreateAttributes `json:"attributes"` - }{} all := struct { - Attributes RoleCreateAttributes `json:"attributes"` - Relationships *RoleRelationships `json:"relationships,omitempty"` - Type *RolesType `json:"type,omitempty"` + Attributes *RoleCreateAttributes `json:"attributes"` + Relationships *RoleRelationships `json:"relationships,omitempty"` + Type *RolesType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -172,6 +161,9 @@ func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -193,7 +185,7 @@ func (o *RoleCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_role_create_request.go b/api/datadogV2/model_role_create_request.go index 46059956d06..d8922bbb821 100644 --- a/api/datadogV2/model_role_create_request.go +++ b/api/datadogV2/model_role_create_request.go @@ -78,21 +78,10 @@ func (o RoleCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RoleCreateData `json:"data"` - }{} all := struct { - Data RoleCreateData `json:"data"` + Data *RoleCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RoleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_create_response.go b/api/datadogV2/model_role_create_response.go index 5dffb29d26f..a6cbba1ecff 100644 --- a/api/datadogV2/model_role_create_response.go +++ b/api/datadogV2/model_role_create_response.go @@ -86,8 +86,7 @@ func (o *RoleCreateResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *RoleCreateResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_create_response_data.go b/api/datadogV2/model_role_create_response_data.go index b5b863a3292..e0ffa33bf83 100644 --- a/api/datadogV2/model_role_create_response_data.go +++ b/api/datadogV2/model_role_create_response_data.go @@ -179,24 +179,13 @@ func (o RoleCreateResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *RolesType `json:"type"` - }{} all := struct { Attributes *RoleCreateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` + Type *RolesType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -204,6 +193,9 @@ func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -235,7 +227,7 @@ func (o *RoleCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_relationships.go b/api/datadogV2/model_role_relationships.go index efc69359760..ba6d8aa205c 100644 --- a/api/datadogV2/model_role_relationships.go +++ b/api/datadogV2/model_role_relationships.go @@ -120,8 +120,7 @@ func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { Permissions *RelationshipToPermissions `json:"permissions,omitempty"` Users *RelationshipToUsers `json:"users,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_response.go b/api/datadogV2/model_role_response.go index 323b2aaa722..bf373463500 100644 --- a/api/datadogV2/model_role_response.go +++ b/api/datadogV2/model_role_response.go @@ -86,8 +86,7 @@ func (o *RoleResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *Role `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_response_relationships.go b/api/datadogV2/model_role_response_relationships.go index 570e463e7f2..81a62191a6b 100644 --- a/api/datadogV2/model_role_response_relationships.go +++ b/api/datadogV2/model_role_response_relationships.go @@ -86,8 +86,7 @@ func (o *RoleResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { Permissions *RelationshipToPermissions `json:"permissions,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_update_attributes.go b/api/datadogV2/model_role_update_attributes.go index bfedbe47b0b..9a4b6c97f7a 100644 --- a/api/datadogV2/model_role_update_attributes.go +++ b/api/datadogV2/model_role_update_attributes.go @@ -163,8 +163,7 @@ func (o *RoleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { ModifiedAt *time.Time `json:"modified_at,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_update_data.go b/api/datadogV2/model_role_update_data.go index 8559cb422cc..dd05c9be1ab 100644 --- a/api/datadogV2/model_role_update_data.go +++ b/api/datadogV2/model_role_update_data.go @@ -167,32 +167,13 @@ func (o RoleUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *RoleUpdateAttributes `json:"attributes"` - Id *string `json:"id"` - Type *RolesType `json:"type"` - }{} all := struct { - Attributes RoleUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Relationships *RoleRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` + Attributes *RoleUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Relationships *RoleRelationships `json:"relationships,omitempty"` + Type *RolesType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +181,15 @@ func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -221,8 +211,8 @@ func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id + o.Attributes = *all.Attributes + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -231,7 +221,7 @@ func (o *RoleUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_update_request.go b/api/datadogV2/model_role_update_request.go index f342491d6c8..7b04596a21c 100644 --- a/api/datadogV2/model_role_update_request.go +++ b/api/datadogV2/model_role_update_request.go @@ -78,21 +78,10 @@ func (o RoleUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RoleUpdateData `json:"data"` - }{} all := struct { - Data RoleUpdateData `json:"data"` + Data *RoleUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RoleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_role_update_response.go b/api/datadogV2/model_role_update_response.go index 813cc2df00e..7e4e1e51ea6 100644 --- a/api/datadogV2/model_role_update_response.go +++ b/api/datadogV2/model_role_update_response.go @@ -86,8 +86,7 @@ func (o *RoleUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *RoleUpdateResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_role_update_response_data.go b/api/datadogV2/model_role_update_response_data.go index c5b35ea5e8d..40b6b608e6d 100644 --- a/api/datadogV2/model_role_update_response_data.go +++ b/api/datadogV2/model_role_update_response_data.go @@ -179,24 +179,13 @@ func (o RoleUpdateResponseData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *RolesType `json:"type"` - }{} all := struct { Attributes *RoleUpdateAttributes `json:"attributes,omitempty"` Id *string `json:"id,omitempty"` Relationships *RoleResponseRelationships `json:"relationships,omitempty"` - Type RolesType `json:"type"` + Type *RolesType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -204,6 +193,9 @@ func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -235,7 +227,7 @@ func (o *RoleUpdateResponseData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_roles_response.go b/api/datadogV2/model_roles_response.go index 6673d6ae79d..2158eb1d2bd 100644 --- a/api/datadogV2/model_roles_response.go +++ b/api/datadogV2/model_roles_response.go @@ -120,8 +120,7 @@ func (o *RolesResponse) UnmarshalJSON(bytes []byte) (err error) { Data []Role `json:"data,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go b/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go index c6db3c9d11b..6b6c9c3222f 100644 --- a/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go +++ b/api/datadogV2/model_rum_aggregate_bucket_value_timeseries_point.go @@ -125,8 +125,7 @@ func (o *RUMAggregateBucketValueTimeseriesPoint) UnmarshalJSON(bytes []byte) (er Time *time.Time `json:"time,omitempty"` Value *float64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_aggregate_request.go b/api/datadogV2/model_rum_aggregate_request.go index 7c999c203bb..0457c888102 100644 --- a/api/datadogV2/model_rum_aggregate_request.go +++ b/api/datadogV2/model_rum_aggregate_request.go @@ -223,8 +223,7 @@ func (o *RUMAggregateRequest) UnmarshalJSON(bytes []byte) (err error) { Options *RUMQueryOptions `json:"options,omitempty"` Page *RUMQueryPageOptions `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_aggregate_sort.go b/api/datadogV2/model_rum_aggregate_sort.go index 2fe3950e4b5..f414bab08ae 100644 --- a/api/datadogV2/model_rum_aggregate_sort.go +++ b/api/datadogV2/model_rum_aggregate_sort.go @@ -192,8 +192,7 @@ func (o *RUMAggregateSort) UnmarshalJSON(bytes []byte) (err error) { Order *RUMSortOrder `json:"order,omitempty"` Type *RUMAggregateSortType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_aggregation_buckets_response.go b/api/datadogV2/model_rum_aggregation_buckets_response.go index 396ac12a227..e56de20fbc3 100644 --- a/api/datadogV2/model_rum_aggregation_buckets_response.go +++ b/api/datadogV2/model_rum_aggregation_buckets_response.go @@ -86,8 +86,7 @@ func (o *RUMAggregationBucketsResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Buckets []RUMBucketResponse `json:"buckets,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_analytics_aggregate_response.go b/api/datadogV2/model_rum_analytics_aggregate_response.go index a2cbe3bb80a..827ab306b82 100644 --- a/api/datadogV2/model_rum_analytics_aggregate_response.go +++ b/api/datadogV2/model_rum_analytics_aggregate_response.go @@ -154,8 +154,7 @@ func (o *RUMAnalyticsAggregateResponse) UnmarshalJSON(bytes []byte) (err error) Links *RUMResponseLinks `json:"links,omitempty"` Meta *RUMResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_application.go b/api/datadogV2/model_rum_application.go index dee44952016..0e62dae877f 100644 --- a/api/datadogV2/model_rum_application.go +++ b/api/datadogV2/model_rum_application.go @@ -134,31 +134,12 @@ func (o RUMApplication) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplication) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *RUMApplicationAttributes `json:"attributes"` Id *string `json:"id"` Type *RUMApplicationType `json:"type"` }{} - all := struct { - Attributes RUMApplicationAttributes `json:"attributes"` - Id string `json:"id"` - Type RUMApplicationType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *RUMApplication) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *RUMApplication) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_attributes.go b/api/datadogV2/model_rum_application_attributes.go index 396ad9d4beb..5a284ae0218 100644 --- a/api/datadogV2/model_rum_application_attributes.go +++ b/api/datadogV2/model_rum_application_attributes.go @@ -360,87 +360,71 @@ func (o RUMApplicationAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ApplicationId *string `json:"application_id"` ClientToken *string `json:"client_token"` CreatedAt *int64 `json:"created_at"` CreatedByHandle *string `json:"created_by_handle"` + Hash *string `json:"hash,omitempty"` + IsActive *bool `json:"is_active,omitempty"` Name *string `json:"name"` OrgId *int32 `json:"org_id"` Type *string `json:"type"` UpdatedAt *int64 `json:"updated_at"` UpdatedByHandle *string `json:"updated_by_handle"` }{} - all := struct { - ApplicationId string `json:"application_id"` - ClientToken string `json:"client_token"` - CreatedAt int64 `json:"created_at"` - CreatedByHandle string `json:"created_by_handle"` - Hash *string `json:"hash,omitempty"` - IsActive *bool `json:"is_active,omitempty"` - Name string `json:"name"` - OrgId int32 `json:"org_id"` - Type string `json:"type"` - UpdatedAt int64 `json:"updated_at"` - UpdatedByHandle string `json:"updated_by_handle"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.ApplicationId == nil { + if all.ApplicationId == nil { return fmt.Errorf("required field application_id missing") } - if required.ClientToken == nil { + if all.ClientToken == nil { return fmt.Errorf("required field client_token missing") } - if required.CreatedAt == nil { + if all.CreatedAt == nil { return fmt.Errorf("required field created_at missing") } - if required.CreatedByHandle == nil { + if all.CreatedByHandle == nil { return fmt.Errorf("required field created_by_handle missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.OrgId == nil { + if all.OrgId == nil { return fmt.Errorf("required field org_id missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - if required.UpdatedAt == nil { + if all.UpdatedAt == nil { return fmt.Errorf("required field updated_at missing") } - if required.UpdatedByHandle == nil { + if all.UpdatedByHandle == nil { return fmt.Errorf("required field updated_by_handle missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "client_token", "created_at", "created_by_handle", "hash", "is_active", "name", "org_id", "type", "updated_at", "updated_by_handle"}) } else { return err } - o.ApplicationId = all.ApplicationId - o.ClientToken = all.ClientToken - o.CreatedAt = all.CreatedAt - o.CreatedByHandle = all.CreatedByHandle + o.ApplicationId = *all.ApplicationId + o.ClientToken = *all.ClientToken + o.CreatedAt = *all.CreatedAt + o.CreatedByHandle = *all.CreatedByHandle o.Hash = all.Hash o.IsActive = all.IsActive - o.Name = all.Name - o.OrgId = all.OrgId - o.Type = all.Type - o.UpdatedAt = all.UpdatedAt - o.UpdatedByHandle = all.UpdatedByHandle + o.Name = *all.Name + o.OrgId = *all.OrgId + o.Type = *all.Type + o.UpdatedAt = *all.UpdatedAt + o.UpdatedByHandle = *all.UpdatedByHandle if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_create.go b/api/datadogV2/model_rum_application_create.go index a0105f7059f..7db4c1b3aaf 100644 --- a/api/datadogV2/model_rum_application_create.go +++ b/api/datadogV2/model_rum_application_create.go @@ -107,26 +107,11 @@ func (o RUMApplicationCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *RUMApplicationCreateAttributes `json:"attributes"` Type *RUMApplicationCreateType `json:"type"` }{} - all := struct { - Attributes RUMApplicationCreateAttributes `json:"attributes"` - Type RUMApplicationCreateType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RUMApplicationCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *RUMApplicationCreate) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_create_attributes.go b/api/datadogV2/model_rum_application_create_attributes.go index 963cfd738bb..7bbc08bc91a 100644 --- a/api/datadogV2/model_rum_application_create_attributes.go +++ b/api/datadogV2/model_rum_application_create_attributes.go @@ -111,22 +111,11 @@ func (o RUMApplicationCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *RUMApplicationCreateAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "type"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name o.Type = all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_rum_application_create_request.go b/api/datadogV2/model_rum_application_create_request.go index 2618f446239..d9deb7a4666 100644 --- a/api/datadogV2/model_rum_application_create_request.go +++ b/api/datadogV2/model_rum_application_create_request.go @@ -78,21 +78,10 @@ func (o RUMApplicationCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RUMApplicationCreate `json:"data"` - }{} all := struct { - Data RUMApplicationCreate `json:"data"` + Data *RUMApplicationCreate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RUMApplicationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RUMApplicationCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_list.go b/api/datadogV2/model_rum_application_list.go index 108aa71cee5..ed70d5e578a 100644 --- a/api/datadogV2/model_rum_application_list.go +++ b/api/datadogV2/model_rum_application_list.go @@ -107,26 +107,11 @@ func (o RUMApplicationList) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationList) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *RUMApplicationListAttributes `json:"attributes"` Type *RUMApplicationListType `json:"type"` }{} - all := struct { - Attributes RUMApplicationListAttributes `json:"attributes"` - Type RUMApplicationListType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *RUMApplicationList) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *RUMApplicationList) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_list_attributes.go b/api/datadogV2/model_rum_application_list_attributes.go index cde237d4cf0..897210c67f0 100644 --- a/api/datadogV2/model_rum_application_list_attributes.go +++ b/api/datadogV2/model_rum_application_list_attributes.go @@ -333,81 +333,66 @@ func (o RUMApplicationListAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationListAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ApplicationId *string `json:"application_id"` CreatedAt *int64 `json:"created_at"` CreatedByHandle *string `json:"created_by_handle"` + Hash *string `json:"hash,omitempty"` + IsActive *bool `json:"is_active,omitempty"` Name *string `json:"name"` OrgId *int32 `json:"org_id"` Type *string `json:"type"` UpdatedAt *int64 `json:"updated_at"` UpdatedByHandle *string `json:"updated_by_handle"` }{} - all := struct { - ApplicationId string `json:"application_id"` - CreatedAt int64 `json:"created_at"` - CreatedByHandle string `json:"created_by_handle"` - Hash *string `json:"hash,omitempty"` - IsActive *bool `json:"is_active,omitempty"` - Name string `json:"name"` - OrgId int32 `json:"org_id"` - Type string `json:"type"` - UpdatedAt int64 `json:"updated_at"` - UpdatedByHandle string `json:"updated_by_handle"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.ApplicationId == nil { + if all.ApplicationId == nil { return fmt.Errorf("required field application_id missing") } - if required.CreatedAt == nil { + if all.CreatedAt == nil { return fmt.Errorf("required field created_at missing") } - if required.CreatedByHandle == nil { + if all.CreatedByHandle == nil { return fmt.Errorf("required field created_by_handle missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.OrgId == nil { + if all.OrgId == nil { return fmt.Errorf("required field org_id missing") } - if required.Type == nil { + if all.Type == nil { return fmt.Errorf("required field type missing") } - if required.UpdatedAt == nil { + if all.UpdatedAt == nil { return fmt.Errorf("required field updated_at missing") } - if required.UpdatedByHandle == nil { + if all.UpdatedByHandle == nil { return fmt.Errorf("required field updated_by_handle missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"application_id", "created_at", "created_by_handle", "hash", "is_active", "name", "org_id", "type", "updated_at", "updated_by_handle"}) } else { return err } - o.ApplicationId = all.ApplicationId - o.CreatedAt = all.CreatedAt - o.CreatedByHandle = all.CreatedByHandle + o.ApplicationId = *all.ApplicationId + o.CreatedAt = *all.CreatedAt + o.CreatedByHandle = *all.CreatedByHandle o.Hash = all.Hash o.IsActive = all.IsActive - o.Name = all.Name - o.OrgId = all.OrgId - o.Type = all.Type - o.UpdatedAt = all.UpdatedAt - o.UpdatedByHandle = all.UpdatedByHandle + o.Name = *all.Name + o.OrgId = *all.OrgId + o.Type = *all.Type + o.UpdatedAt = *all.UpdatedAt + o.UpdatedByHandle = *all.UpdatedByHandle if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_response.go b/api/datadogV2/model_rum_application_response.go index 5cd2ed1d2c2..efe09cd1c24 100644 --- a/api/datadogV2/model_rum_application_response.go +++ b/api/datadogV2/model_rum_application_response.go @@ -86,8 +86,7 @@ func (o *RUMApplicationResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *RUMApplication `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_application_update.go b/api/datadogV2/model_rum_application_update.go index 66e678b86ad..0ab49f0f9eb 100644 --- a/api/datadogV2/model_rum_application_update.go +++ b/api/datadogV2/model_rum_application_update.go @@ -140,27 +140,12 @@ func (o RUMApplicationUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationUpdate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *RUMApplicationUpdateType `json:"type"` - }{} all := struct { Attributes *RUMApplicationUpdateAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type RUMApplicationUpdateType `json:"type"` + Id *string `json:"id"` + Type *RUMApplicationUpdateType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *RUMApplicationUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *RUMApplicationUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_application_update_attributes.go b/api/datadogV2/model_rum_application_update_attributes.go index 2a694836439..cac4faaf98a 100644 --- a/api/datadogV2/model_rum_application_update_attributes.go +++ b/api/datadogV2/model_rum_application_update_attributes.go @@ -120,8 +120,7 @@ func (o *RUMApplicationUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_application_update_request.go b/api/datadogV2/model_rum_application_update_request.go index b4a74b7db51..e30b2a66d62 100644 --- a/api/datadogV2/model_rum_application_update_request.go +++ b/api/datadogV2/model_rum_application_update_request.go @@ -78,21 +78,10 @@ func (o RUMApplicationUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMApplicationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *RUMApplicationUpdate `json:"data"` - }{} all := struct { - Data RUMApplicationUpdate `json:"data"` + Data *RUMApplicationUpdate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *RUMApplicationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *RUMApplicationUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_applications_response.go b/api/datadogV2/model_rum_applications_response.go index 656edff27df..f1697ae1c15 100644 --- a/api/datadogV2/model_rum_applications_response.go +++ b/api/datadogV2/model_rum_applications_response.go @@ -86,8 +86,7 @@ func (o *RUMApplicationsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []RUMApplicationList `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_bucket_response.go b/api/datadogV2/model_rum_bucket_response.go index 25b7f5c4a5d..7e75455b3e2 100644 --- a/api/datadogV2/model_rum_bucket_response.go +++ b/api/datadogV2/model_rum_bucket_response.go @@ -120,8 +120,7 @@ func (o *RUMBucketResponse) UnmarshalJSON(bytes []byte) (err error) { By map[string]string `json:"by,omitempty"` Computes map[string]RUMAggregateBucketValue `json:"computes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_compute.go b/api/datadogV2/model_rum_compute.go index f9d5334948d..2dd7a0c7c0b 100644 --- a/api/datadogV2/model_rum_compute.go +++ b/api/datadogV2/model_rum_compute.go @@ -182,24 +182,13 @@ func (o RUMCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Aggregation *RUMAggregationFunction `json:"aggregation"` - }{} all := struct { - Aggregation RUMAggregationFunction `json:"aggregation"` - Interval *string `json:"interval,omitempty"` - Metric *string `json:"metric,omitempty"` - Type *RUMComputeType `json:"type,omitempty"` + Aggregation *RUMAggregationFunction `json:"aggregation"` + Interval *string `json:"interval,omitempty"` + Metric *string `json:"metric,omitempty"` + Type *RUMComputeType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Aggregation == nil { - return fmt.Errorf("required field aggregation missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -207,6 +196,9 @@ func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Aggregation == nil { + return fmt.Errorf("required field aggregation missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "interval", "metric", "type"}) @@ -229,7 +221,7 @@ func (o *RUMCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Aggregation = all.Aggregation + o.Aggregation = *all.Aggregation o.Interval = all.Interval o.Metric = all.Metric o.Type = all.Type diff --git a/api/datadogV2/model_rum_event.go b/api/datadogV2/model_rum_event.go index fff5b7613c1..a3e7340867d 100644 --- a/api/datadogV2/model_rum_event.go +++ b/api/datadogV2/model_rum_event.go @@ -158,8 +158,7 @@ func (o *RUMEvent) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *RUMEventType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_event_attributes.go b/api/datadogV2/model_rum_event_attributes.go index e4c8bc8f804..dc1add717ad 100644 --- a/api/datadogV2/model_rum_event_attributes.go +++ b/api/datadogV2/model_rum_event_attributes.go @@ -195,8 +195,7 @@ func (o *RUMEventAttributes) UnmarshalJSON(bytes []byte) (err error) { Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_events_response.go b/api/datadogV2/model_rum_events_response.go index ed2a54aa5c6..af306c2065b 100644 --- a/api/datadogV2/model_rum_events_response.go +++ b/api/datadogV2/model_rum_events_response.go @@ -154,8 +154,7 @@ func (o *RUMEventsResponse) UnmarshalJSON(bytes []byte) (err error) { Links *RUMResponseLinks `json:"links,omitempty"` Meta *RUMResponseMetadata `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_group_by.go b/api/datadogV2/model_rum_group_by.go index 0c4d741fccd..6fe45ef2e84 100644 --- a/api/datadogV2/model_rum_group_by.go +++ b/api/datadogV2/model_rum_group_by.go @@ -248,26 +248,15 @@ func (o RUMGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Facet *string `json:"facet"` - }{} all := struct { - Facet string `json:"facet"` + Facet *string `json:"facet"` Histogram *RUMGroupByHistogram `json:"histogram,omitempty"` Limit *int64 `json:"limit,omitempty"` Missing *RUMGroupByMissing `json:"missing,omitempty"` Sort *RUMAggregateSort `json:"sort,omitempty"` Total *RUMGroupByTotal `json:"total,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Facet == nil { - return fmt.Errorf("required field facet missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -275,13 +264,16 @@ func (o *RUMGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Facet == nil { + return fmt.Errorf("required field facet missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"facet", "histogram", "limit", "missing", "sort", "total"}) } else { return err } - o.Facet = all.Facet + o.Facet = *all.Facet if all.Histogram != nil && all.Histogram.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_rum_group_by_histogram.go b/api/datadogV2/model_rum_group_by_histogram.go index 3ca68fb01de..c4637e86a63 100644 --- a/api/datadogV2/model_rum_group_by_histogram.go +++ b/api/datadogV2/model_rum_group_by_histogram.go @@ -135,31 +135,12 @@ func (o RUMGroupByHistogram) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RUMGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Interval *float64 `json:"interval"` Max *float64 `json:"max"` Min *float64 `json:"min"` }{} - all := struct { - Interval float64 `json:"interval"` - Max float64 `json:"max"` - Min float64 `json:"min"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Interval == nil { - return fmt.Errorf("required field interval missing") - } - if required.Max == nil { - return fmt.Errorf("required field max missing") - } - if required.Min == nil { - return fmt.Errorf("required field min missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -167,15 +148,24 @@ func (o *RUMGroupByHistogram) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Interval == nil { + return fmt.Errorf("required field interval missing") + } + if all.Max == nil { + return fmt.Errorf("required field max missing") + } + if all.Min == nil { + return fmt.Errorf("required field min missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"interval", "max", "min"}) } else { return err } - o.Interval = all.Interval - o.Max = all.Max - o.Min = all.Min + o.Interval = *all.Interval + o.Max = *all.Max + o.Min = *all.Min if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_rum_query_filter.go b/api/datadogV2/model_rum_query_filter.go index f41de3695f2..d7d8dd3de87 100644 --- a/api/datadogV2/model_rum_query_filter.go +++ b/api/datadogV2/model_rum_query_filter.go @@ -166,8 +166,7 @@ func (o *RUMQueryFilter) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query,omitempty"` To *string `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_query_options.go b/api/datadogV2/model_rum_query_options.go index 1d4695d2ce7..f92500d8b43 100644 --- a/api/datadogV2/model_rum_query_options.go +++ b/api/datadogV2/model_rum_query_options.go @@ -125,8 +125,7 @@ func (o *RUMQueryOptions) UnmarshalJSON(bytes []byte) (err error) { TimeOffset *int64 `json:"time_offset,omitempty"` Timezone *string `json:"timezone,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_query_page_options.go b/api/datadogV2/model_rum_query_page_options.go index 159060875cd..ab1ab7834ed 100644 --- a/api/datadogV2/model_rum_query_page_options.go +++ b/api/datadogV2/model_rum_query_page_options.go @@ -124,8 +124,7 @@ func (o *RUMQueryPageOptions) UnmarshalJSON(bytes []byte) (err error) { Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_response_links.go b/api/datadogV2/model_rum_response_links.go index abbccd96f3a..f1de23dbf6c 100644 --- a/api/datadogV2/model_rum_response_links.go +++ b/api/datadogV2/model_rum_response_links.go @@ -87,8 +87,7 @@ func (o *RUMResponseLinks) UnmarshalJSON(bytes []byte) (err error) { all := struct { Next *string `json:"next,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_response_metadata.go b/api/datadogV2/model_rum_response_metadata.go index 465992294f3..a98fce3595b 100644 --- a/api/datadogV2/model_rum_response_metadata.go +++ b/api/datadogV2/model_rum_response_metadata.go @@ -223,8 +223,7 @@ func (o *RUMResponseMetadata) UnmarshalJSON(bytes []byte) (err error) { Status *RUMResponseStatus `json:"status,omitempty"` Warnings []RUMWarning `json:"warnings,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_response_page.go b/api/datadogV2/model_rum_response_page.go index c31f714fe24..7c8042cf470 100644 --- a/api/datadogV2/model_rum_response_page.go +++ b/api/datadogV2/model_rum_response_page.go @@ -86,8 +86,7 @@ func (o *RUMResponsePage) UnmarshalJSON(bytes []byte) (err error) { all := struct { After *string `json:"after,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_search_events_request.go b/api/datadogV2/model_rum_search_events_request.go index a1027aaa7f6..0f376fc93b8 100644 --- a/api/datadogV2/model_rum_search_events_request.go +++ b/api/datadogV2/model_rum_search_events_request.go @@ -189,8 +189,7 @@ func (o *RUMSearchEventsRequest) UnmarshalJSON(bytes []byte) (err error) { Page *RUMQueryPageOptions `json:"page,omitempty"` Sort *RUMSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_rum_warning.go b/api/datadogV2/model_rum_warning.go index 3b3e120aa90..8c0b4b7088d 100644 --- a/api/datadogV2/model_rum_warning.go +++ b/api/datadogV2/model_rum_warning.go @@ -154,8 +154,7 @@ func (o *RUMWarning) UnmarshalJSON(bytes []byte) (err error) { Detail *string `json:"detail,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_saml_assertion_attribute.go b/api/datadogV2/model_saml_assertion_attribute.go index bfd2f1fbd47..473038aafec 100644 --- a/api/datadogV2/model_saml_assertion_attribute.go +++ b/api/datadogV2/model_saml_assertion_attribute.go @@ -140,27 +140,12 @@ func (o SAMLAssertionAttribute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *SAMLAssertionAttributesType `json:"type"` - }{} all := struct { Attributes *SAMLAssertionAttributeAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type SAMLAssertionAttributesType `json:"type"` + Id *string `json:"id"` + Type *SAMLAssertionAttributesType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *SAMLAssertionAttribute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_saml_assertion_attribute_attributes.go b/api/datadogV2/model_saml_assertion_attribute_attributes.go index b4cd03dec84..7f32794f4c6 100644 --- a/api/datadogV2/model_saml_assertion_attribute_attributes.go +++ b/api/datadogV2/model_saml_assertion_attribute_attributes.go @@ -120,8 +120,7 @@ func (o *SAMLAssertionAttributeAttributes) UnmarshalJSON(bytes []byte) (err erro AttributeKey *string `json:"attribute_key,omitempty"` AttributeValue *string `json:"attribute_value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_scalar_formula_query_request.go b/api/datadogV2/model_scalar_formula_query_request.go index 3b6a6038193..7f0f02e3ff6 100644 --- a/api/datadogV2/model_scalar_formula_query_request.go +++ b/api/datadogV2/model_scalar_formula_query_request.go @@ -78,21 +78,10 @@ func (o ScalarFormulaQueryRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ScalarFormulaRequest `json:"data"` - }{} all := struct { - Data ScalarFormulaRequest `json:"data"` + Data *ScalarFormulaRequest `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ScalarFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ScalarFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_scalar_formula_query_response.go b/api/datadogV2/model_scalar_formula_query_response.go index 55d5c3b5970..2429b2379fc 100644 --- a/api/datadogV2/model_scalar_formula_query_response.go +++ b/api/datadogV2/model_scalar_formula_query_response.go @@ -120,8 +120,7 @@ func (o *ScalarFormulaQueryResponse) UnmarshalJSON(bytes []byte) (err error) { Data *ScalarResponse `json:"data,omitempty"` Errors *string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_scalar_formula_request.go b/api/datadogV2/model_scalar_formula_request.go index e7b84a4708e..9f43b6bfa89 100644 --- a/api/datadogV2/model_scalar_formula_request.go +++ b/api/datadogV2/model_scalar_formula_request.go @@ -107,26 +107,11 @@ func (o ScalarFormulaRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *ScalarFormulaRequestAttributes `json:"attributes"` Type *ScalarFormulaRequestType `json:"type"` }{} - all := struct { - Attributes ScalarFormulaRequestAttributes `json:"attributes"` - Type ScalarFormulaRequestType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *ScalarFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *ScalarFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_scalar_formula_request_attributes.go b/api/datadogV2/model_scalar_formula_request_attributes.go index 6cf499e55e9..c8597274770 100644 --- a/api/datadogV2/model_scalar_formula_request_attributes.go +++ b/api/datadogV2/model_scalar_formula_request_attributes.go @@ -165,32 +165,13 @@ func (o ScalarFormulaRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ScalarFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - From *int64 `json:"from"` - Queries *[]ScalarQuery `json:"queries"` - To *int64 `json:"to"` - }{} all := struct { Formulas []QueryFormula `json:"formulas,omitempty"` - From int64 `json:"from"` - Queries []ScalarQuery `json:"queries"` - To int64 `json:"to"` + From *int64 `json:"from"` + Queries *[]ScalarQuery `json:"queries"` + To *int64 `json:"to"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.From == nil { - return fmt.Errorf("required field from missing") - } - if required.Queries == nil { - return fmt.Errorf("required field queries missing") - } - if required.To == nil { - return fmt.Errorf("required field to missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,6 +179,15 @@ func (o *ScalarFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.Queries == nil { + return fmt.Errorf("required field queries missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"formulas", "from", "queries", "to"}) @@ -205,9 +195,9 @@ func (o *ScalarFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) return err } o.Formulas = all.Formulas - o.From = all.From - o.Queries = all.Queries - o.To = all.To + o.From = *all.From + o.Queries = *all.Queries + o.To = *all.To if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_scalar_formula_response_atrributes.go b/api/datadogV2/model_scalar_formula_response_atrributes.go index b733970fb6f..ff8468d7763 100644 --- a/api/datadogV2/model_scalar_formula_response_atrributes.go +++ b/api/datadogV2/model_scalar_formula_response_atrributes.go @@ -86,8 +86,7 @@ func (o *ScalarFormulaResponseAtrributes) UnmarshalJSON(bytes []byte) (err error all := struct { Columns []ScalarColumn `json:"columns,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_scalar_meta.go b/api/datadogV2/model_scalar_meta.go index 15f4437ce06..2af4c1aab6e 100644 --- a/api/datadogV2/model_scalar_meta.go +++ b/api/datadogV2/model_scalar_meta.go @@ -89,8 +89,7 @@ func (o *ScalarMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Unit []Unit `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_scalar_response.go b/api/datadogV2/model_scalar_response.go index cc30750f6eb..7118b6ccd3c 100644 --- a/api/datadogV2/model_scalar_response.go +++ b/api/datadogV2/model_scalar_response.go @@ -124,8 +124,7 @@ func (o *ScalarResponse) UnmarshalJSON(bytes []byte) (err error) { Attributes *ScalarFormulaResponseAtrributes `json:"attributes,omitempty"` Type *ScalarFormulaResponseType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter.go b/api/datadogV2/model_security_filter.go index a7feb95ac20..e76e941b5cb 100644 --- a/api/datadogV2/model_security_filter.go +++ b/api/datadogV2/model_security_filter.go @@ -158,8 +158,7 @@ func (o *SecurityFilter) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *SecurityFilterType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter_attributes.go b/api/datadogV2/model_security_filter_attributes.go index cddb7b3d375..6f10a3e45d2 100644 --- a/api/datadogV2/model_security_filter_attributes.go +++ b/api/datadogV2/model_security_filter_attributes.go @@ -290,8 +290,7 @@ func (o *SecurityFilterAttributes) UnmarshalJSON(bytes []byte) (err error) { Query *string `json:"query,omitempty"` Version *int32 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter_create_attributes.go b/api/datadogV2/model_security_filter_create_attributes.go index 18d3ff6c015..660b4710ecf 100644 --- a/api/datadogV2/model_security_filter_create_attributes.go +++ b/api/datadogV2/model_security_filter_create_attributes.go @@ -186,48 +186,36 @@ func (o SecurityFilterCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ExclusionFilters *[]SecurityFilterExclusionFilter `json:"exclusion_filters"` FilteredDataType *SecurityFilterFilteredDataType `json:"filtered_data_type"` IsEnabled *bool `json:"is_enabled"` Name *string `json:"name"` Query *string `json:"query"` }{} - all := struct { - ExclusionFilters []SecurityFilterExclusionFilter `json:"exclusion_filters"` - FilteredDataType SecurityFilterFilteredDataType `json:"filtered_data_type"` - IsEnabled bool `json:"is_enabled"` - Name string `json:"name"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.ExclusionFilters == nil { + if all.ExclusionFilters == nil { return fmt.Errorf("required field exclusion_filters missing") } - if required.FilteredDataType == nil { + if all.FilteredDataType == nil { return fmt.Errorf("required field filtered_data_type missing") } - if required.IsEnabled == nil { + if all.IsEnabled == nil { return fmt.Errorf("required field is_enabled missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Query == nil { + if all.Query == nil { return fmt.Errorf("required field query missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"exclusion_filters", "filtered_data_type", "is_enabled", "name", "query"}) @@ -242,11 +230,11 @@ func (o *SecurityFilterCreateAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.ExclusionFilters = all.ExclusionFilters - o.FilteredDataType = all.FilteredDataType - o.IsEnabled = all.IsEnabled - o.Name = all.Name - o.Query = all.Query + o.ExclusionFilters = *all.ExclusionFilters + o.FilteredDataType = *all.FilteredDataType + o.IsEnabled = *all.IsEnabled + o.Name = *all.Name + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_filter_create_data.go b/api/datadogV2/model_security_filter_create_data.go index d3dfd91aeb7..35896926d11 100644 --- a/api/datadogV2/model_security_filter_create_data.go +++ b/api/datadogV2/model_security_filter_create_data.go @@ -107,26 +107,11 @@ func (o SecurityFilterCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *SecurityFilterCreateAttributes `json:"attributes"` Type *SecurityFilterType `json:"type"` }{} - all := struct { - Attributes SecurityFilterCreateAttributes `json:"attributes"` - Type SecurityFilterType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *SecurityFilterCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_filter_create_request.go b/api/datadogV2/model_security_filter_create_request.go index 90cae003f8b..d81ebdeedb7 100644 --- a/api/datadogV2/model_security_filter_create_request.go +++ b/api/datadogV2/model_security_filter_create_request.go @@ -78,21 +78,10 @@ func (o SecurityFilterCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SecurityFilterCreateData `json:"data"` - }{} all := struct { - Data SecurityFilterCreateData `json:"data"` + Data *SecurityFilterCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SecurityFilterCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_filter_exclusion_filter.go b/api/datadogV2/model_security_filter_exclusion_filter.go index be81a0efa0c..8c7f9d94f2c 100644 --- a/api/datadogV2/model_security_filter_exclusion_filter.go +++ b/api/datadogV2/model_security_filter_exclusion_filter.go @@ -105,26 +105,11 @@ func (o SecurityFilterExclusionFilter) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterExclusionFilter) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Name *string `json:"name"` Query *string `json:"query"` }{} - all := struct { - Name string `json:"name"` - Query string `json:"query"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,14 +117,20 @@ func (o *SecurityFilterExclusionFilter) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "query"}) } else { return err } - o.Name = all.Name - o.Query = all.Query + o.Name = *all.Name + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_filter_exclusion_filter_response.go b/api/datadogV2/model_security_filter_exclusion_filter_response.go index cfac0f1a75e..dabf76440f8 100644 --- a/api/datadogV2/model_security_filter_exclusion_filter_response.go +++ b/api/datadogV2/model_security_filter_exclusion_filter_response.go @@ -120,8 +120,7 @@ func (o *SecurityFilterExclusionFilterResponse) UnmarshalJSON(bytes []byte) (err Name *string `json:"name,omitempty"` Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter_meta.go b/api/datadogV2/model_security_filter_meta.go index b20a8d5f4ae..9dc273a0cac 100644 --- a/api/datadogV2/model_security_filter_meta.go +++ b/api/datadogV2/model_security_filter_meta.go @@ -86,8 +86,7 @@ func (o *SecurityFilterMeta) UnmarshalJSON(bytes []byte) (err error) { all := struct { Warning *string `json:"warning,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter_response.go b/api/datadogV2/model_security_filter_response.go index adbdc2a5eff..0f09e4a671d 100644 --- a/api/datadogV2/model_security_filter_response.go +++ b/api/datadogV2/model_security_filter_response.go @@ -120,8 +120,7 @@ func (o *SecurityFilterResponse) UnmarshalJSON(bytes []byte) (err error) { Data *SecurityFilter `json:"data,omitempty"` Meta *SecurityFilterMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter_update_attributes.go b/api/datadogV2/model_security_filter_update_attributes.go index 55ced5c570a..7c47a688eb1 100644 --- a/api/datadogV2/model_security_filter_update_attributes.go +++ b/api/datadogV2/model_security_filter_update_attributes.go @@ -256,8 +256,7 @@ func (o *SecurityFilterUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) Query *string `json:"query,omitempty"` Version *int32 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_filter_update_data.go b/api/datadogV2/model_security_filter_update_data.go index 0d29fd91a02..46450a85a82 100644 --- a/api/datadogV2/model_security_filter_update_data.go +++ b/api/datadogV2/model_security_filter_update_data.go @@ -107,26 +107,11 @@ func (o SecurityFilterUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *SecurityFilterUpdateAttributes `json:"attributes"` Type *SecurityFilterType `json:"type"` }{} - all := struct { - Attributes SecurityFilterUpdateAttributes `json:"attributes"` - Type SecurityFilterType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *SecurityFilterUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_filter_update_request.go b/api/datadogV2/model_security_filter_update_request.go index b78a1f29dbb..744ed06a37d 100644 --- a/api/datadogV2/model_security_filter_update_request.go +++ b/api/datadogV2/model_security_filter_update_request.go @@ -78,21 +78,10 @@ func (o SecurityFilterUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SecurityFilterUpdateData `json:"data"` - }{} all := struct { - Data SecurityFilterUpdateData `json:"data"` + Data *SecurityFilterUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SecurityFilterUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_filters_response.go b/api/datadogV2/model_security_filters_response.go index ec16f099f58..423a3f0c657 100644 --- a/api/datadogV2/model_security_filters_response.go +++ b/api/datadogV2/model_security_filters_response.go @@ -120,8 +120,7 @@ func (o *SecurityFiltersResponse) UnmarshalJSON(bytes []byte) (err error) { Data []SecurityFilter `json:"data,omitempty"` Meta *SecurityFilterMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_filter.go b/api/datadogV2/model_security_monitoring_filter.go index 03fc0be4dfe..e6e10bfccfb 100644 --- a/api/datadogV2/model_security_monitoring_filter.go +++ b/api/datadogV2/model_security_monitoring_filter.go @@ -120,8 +120,7 @@ func (o *SecurityMonitoringFilter) UnmarshalJSON(bytes []byte) (err error) { Action *SecurityMonitoringFilterAction `json:"action,omitempty"` Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_list_rules_response.go b/api/datadogV2/model_security_monitoring_list_rules_response.go index 97c067a8518..bfe6aa7563c 100644 --- a/api/datadogV2/model_security_monitoring_list_rules_response.go +++ b/api/datadogV2/model_security_monitoring_list_rules_response.go @@ -120,8 +120,7 @@ func (o *SecurityMonitoringListRulesResponse) UnmarshalJSON(bytes []byte) (err e Data []SecurityMonitoringRuleResponse `json:"data,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_rule_case.go b/api/datadogV2/model_security_monitoring_rule_case.go index ea92694ce8e..2c88dbf5b98 100644 --- a/api/datadogV2/model_security_monitoring_rule_case.go +++ b/api/datadogV2/model_security_monitoring_rule_case.go @@ -189,8 +189,7 @@ func (o *SecurityMonitoringRuleCase) UnmarshalJSON(bytes []byte) (err error) { Notifications []string `json:"notifications,omitempty"` Status *SecurityMonitoringRuleSeverity `json:"status,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_rule_case_create.go b/api/datadogV2/model_security_monitoring_rule_case_create.go index da725fb785e..dc9b8daa42c 100644 --- a/api/datadogV2/model_security_monitoring_rule_case_create.go +++ b/api/datadogV2/model_security_monitoring_rule_case_create.go @@ -178,24 +178,13 @@ func (o SecurityMonitoringRuleCaseCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Status *SecurityMonitoringRuleSeverity `json:"status"` - }{} all := struct { - Condition *string `json:"condition,omitempty"` - Name *string `json:"name,omitempty"` - Notifications []string `json:"notifications,omitempty"` - Status SecurityMonitoringRuleSeverity `json:"status"` + Condition *string `json:"condition,omitempty"` + Name *string `json:"name,omitempty"` + Notifications []string `json:"notifications,omitempty"` + Status *SecurityMonitoringRuleSeverity `json:"status"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -203,6 +192,9 @@ func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro o.UnparsedObject = raw return nil } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"condition", "name", "notifications", "status"}) @@ -220,7 +212,7 @@ func (o *SecurityMonitoringRuleCaseCreate) UnmarshalJSON(bytes []byte) (err erro o.Condition = all.Condition o.Name = all.Name o.Notifications = all.Notifications - o.Status = all.Status + o.Status = *all.Status if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go b/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go index b3b27e5a5b4..7e2d848130f 100644 --- a/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go +++ b/api/datadogV2/model_security_monitoring_rule_impossible_travel_options.go @@ -87,8 +87,7 @@ func (o *SecurityMonitoringRuleImpossibleTravelOptions) UnmarshalJSON(bytes []by all := struct { BaselineUserLocations *bool `json:"baselineUserLocations,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_rule_new_value_options.go b/api/datadogV2/model_security_monitoring_rule_new_value_options.go index 63586f3aafb..500f7c83319 100644 --- a/api/datadogV2/model_security_monitoring_rule_new_value_options.go +++ b/api/datadogV2/model_security_monitoring_rule_new_value_options.go @@ -201,8 +201,7 @@ func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_rule_options.go b/api/datadogV2/model_security_monitoring_rule_options.go index eb597b7508f..63562ca80af 100644 --- a/api/datadogV2/model_security_monitoring_rule_options.go +++ b/api/datadogV2/model_security_monitoring_rule_options.go @@ -365,8 +365,7 @@ func (o *SecurityMonitoringRuleOptions) UnmarshalJSON(bytes []byte) (err error) MaxSignalDuration *SecurityMonitoringRuleMaxSignalDuration `json:"maxSignalDuration,omitempty"` NewValueOptions *SecurityMonitoringRuleNewValueOptions `json:"newValueOptions,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_rule_update_payload.go b/api/datadogV2/model_security_monitoring_rule_update_payload.go index 57e0556ec68..ee8f1f240a4 100644 --- a/api/datadogV2/model_security_monitoring_rule_update_payload.go +++ b/api/datadogV2/model_security_monitoring_rule_update_payload.go @@ -426,8 +426,7 @@ func (o *SecurityMonitoringRuleUpdatePayload) UnmarshalJSON(bytes []byte) (err e Tags []string `json:"tags,omitempty"` Version *int32 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal.go b/api/datadogV2/model_security_monitoring_signal.go index 928e532b51e..6b6411707d3 100644 --- a/api/datadogV2/model_security_monitoring_signal.go +++ b/api/datadogV2/model_security_monitoring_signal.go @@ -159,8 +159,7 @@ func (o *SecurityMonitoringSignal) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *SecurityMonitoringSignalType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go b/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go index 168876138a3..23c5e91a69b 100644 --- a/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go +++ b/api/datadogV2/model_security_monitoring_signal_assignee_update_attributes.go @@ -111,22 +111,11 @@ func (o SecurityMonitoringSignalAssigneeUpdateAttributes) MarshalJSON() ([]byte, // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Assignee *SecurityMonitoringTriageUser `json:"assignee"` - }{} all := struct { - Assignee SecurityMonitoringTriageUser `json:"assignee"` - Version *int64 `json:"version,omitempty"` + Assignee *SecurityMonitoringTriageUser `json:"assignee"` + Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignee == nil { - return fmt.Errorf("required field assignee missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes [ o.UnparsedObject = raw return nil } + if all.Assignee == nil { + return fmt.Errorf("required field assignee missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"assignee", "version"}) @@ -147,7 +139,7 @@ func (o *SecurityMonitoringSignalAssigneeUpdateAttributes) UnmarshalJSON(bytes [ } o.UnparsedObject = raw } - o.Assignee = all.Assignee + o.Assignee = *all.Assignee o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go b/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go index b9d270c2bfa..2a46e809b9d 100644 --- a/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go +++ b/api/datadogV2/model_security_monitoring_signal_assignee_update_data.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalAssigneeUpdateData) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` - }{} all := struct { - Attributes SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` + Attributes *SecurityMonitoringSignalAssigneeUpdateAttributes `json:"attributes"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalAssigneeUpdateData) UnmarshalJSON(bytes []byte) } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go b/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go index 132870bd086..d8b0fbe9434 100644 --- a/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go +++ b/api/datadogV2/model_security_monitoring_signal_assignee_update_request.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalAssigneeUpdateRequest) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalAssigneeUpdateData `json:"data"` - }{} all := struct { - Data SecurityMonitoringSignalAssigneeUpdateData `json:"data"` + Data *SecurityMonitoringSignalAssigneeUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalAssigneeUpdateRequest) UnmarshalJSON(bytes []by } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_attributes.go b/api/datadogV2/model_security_monitoring_signal_attributes.go index a47a225531d..3392fe6fc1f 100644 --- a/api/datadogV2/model_security_monitoring_signal_attributes.go +++ b/api/datadogV2/model_security_monitoring_signal_attributes.go @@ -194,8 +194,7 @@ func (o *SecurityMonitoringSignalAttributes) UnmarshalJSON(bytes []byte) (err er Tags []string `json:"tags,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go b/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go index 457db07e418..64ce4f9ce5d 100644 --- a/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go +++ b/api/datadogV2/model_security_monitoring_signal_incidents_update_attributes.go @@ -111,22 +111,11 @@ func (o SecurityMonitoringSignalIncidentsUpdateAttributes) MarshalJSON() ([]byte // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - IncidentIds *[]int64 `json:"incident_ids"` - }{} all := struct { - IncidentIds []int64 `json:"incident_ids"` - Version *int64 `json:"version,omitempty"` + IncidentIds *[]int64 `json:"incident_ids"` + Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.IncidentIds == nil { - return fmt.Errorf("required field incident_ids missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *SecurityMonitoringSignalIncidentsUpdateAttributes) UnmarshalJSON(bytes o.UnparsedObject = raw return nil } + if all.IncidentIds == nil { + return fmt.Errorf("required field incident_ids missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"incident_ids", "version"}) } else { return err } - o.IncidentIds = all.IncidentIds + o.IncidentIds = *all.IncidentIds o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go b/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go index 507ca01741a..0d64bc41dba 100644 --- a/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go +++ b/api/datadogV2/model_security_monitoring_signal_incidents_update_data.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalIncidentsUpdateData) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` - }{} all := struct { - Attributes SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` + Attributes *SecurityMonitoringSignalIncidentsUpdateAttributes `json:"attributes"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalIncidentsUpdateData) UnmarshalJSON(bytes []byte } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go b/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go index 332bf883516..4a9b84d4d08 100644 --- a/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go +++ b/api/datadogV2/model_security_monitoring_signal_incidents_update_request.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalIncidentsUpdateRequest) MarshalJSON() ([]byte, e // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalIncidentsUpdateData `json:"data"` - }{} all := struct { - Data SecurityMonitoringSignalIncidentsUpdateData `json:"data"` + Data *SecurityMonitoringSignalIncidentsUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []b o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalIncidentsUpdateRequest) UnmarshalJSON(bytes []b } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_list_request.go b/api/datadogV2/model_security_monitoring_signal_list_request.go index a6021cf298f..5b889d53cba 100644 --- a/api/datadogV2/model_security_monitoring_signal_list_request.go +++ b/api/datadogV2/model_security_monitoring_signal_list_request.go @@ -154,8 +154,7 @@ func (o *SecurityMonitoringSignalListRequest) UnmarshalJSON(bytes []byte) (err e Page *SecurityMonitoringSignalListRequestPage `json:"page,omitempty"` Sort *SecurityMonitoringSignalsSort `json:"sort,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_list_request_filter.go b/api/datadogV2/model_security_monitoring_signal_list_request_filter.go index 16c5c2d38e1..1dc1384abd2 100644 --- a/api/datadogV2/model_security_monitoring_signal_list_request_filter.go +++ b/api/datadogV2/model_security_monitoring_signal_list_request_filter.go @@ -163,8 +163,7 @@ func (o *SecurityMonitoringSignalListRequestFilter) UnmarshalJSON(bytes []byte) Query *string `json:"query,omitempty"` To *time.Time `json:"to,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_list_request_page.go b/api/datadogV2/model_security_monitoring_signal_list_request_page.go index d42f86a9bb9..e1b77fcbcf9 100644 --- a/api/datadogV2/model_security_monitoring_signal_list_request_page.go +++ b/api/datadogV2/model_security_monitoring_signal_list_request_page.go @@ -124,8 +124,7 @@ func (o *SecurityMonitoringSignalListRequestPage) UnmarshalJSON(bytes []byte) (e Cursor *string `json:"cursor,omitempty"` Limit *int32 `json:"limit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go b/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go index 0a0d52dfd7c..68535e1c48b 100644 --- a/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go +++ b/api/datadogV2/model_security_monitoring_signal_rule_create_payload.go @@ -345,57 +345,44 @@ func (o SecurityMonitoringSignalRuleCreatePayload) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` - IsEnabled *bool `json:"isEnabled"` - Message *string `json:"message"` - Name *string `json:"name"` - Options *SecurityMonitoringRuleOptions `json:"options"` - Queries *[]SecurityMonitoringSignalRuleQuery `json:"queries"` - }{} all := struct { - Cases []SecurityMonitoringRuleCaseCreate `json:"cases"` - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - IsEnabled bool `json:"isEnabled"` - Message string `json:"message"` - Name string `json:"name"` - Options SecurityMonitoringRuleOptions `json:"options"` - Queries []SecurityMonitoringSignalRuleQuery `json:"queries"` - Tags []string `json:"tags,omitempty"` - Type *SecurityMonitoringSignalRuleType `json:"type,omitempty"` + Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + IsEnabled *bool `json:"isEnabled"` + Message *string `json:"message"` + Name *string `json:"name"` + Options *SecurityMonitoringRuleOptions `json:"options"` + Queries *[]SecurityMonitoringSignalRuleQuery `json:"queries"` + Tags []string `json:"tags,omitempty"` + Type *SecurityMonitoringSignalRuleType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Cases == nil { + if all.Cases == nil { return fmt.Errorf("required field cases missing") } - if required.IsEnabled == nil { + if all.IsEnabled == nil { return fmt.Errorf("required field isEnabled missing") } - if required.Message == nil { + if all.Message == nil { return fmt.Errorf("required field message missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Options == nil { + if all.Options == nil { return fmt.Errorf("required field options missing") } - if required.Queries == nil { + if all.Queries == nil { return fmt.Errorf("required field queries missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"cases", "filters", "hasExtendedTitle", "isEnabled", "message", "name", "options", "queries", "tags", "type"}) @@ -410,12 +397,12 @@ func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } - o.Cases = all.Cases + o.Cases = *all.Cases o.Filters = all.Filters o.HasExtendedTitle = all.HasExtendedTitle - o.IsEnabled = all.IsEnabled - o.Message = all.Message - o.Name = all.Name + o.IsEnabled = *all.IsEnabled + o.Message = *all.Message + o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -423,8 +410,8 @@ func (o *SecurityMonitoringSignalRuleCreatePayload) UnmarshalJSON(bytes []byte) } o.UnparsedObject = raw } - o.Options = all.Options - o.Queries = all.Queries + o.Options = *all.Options + o.Queries = *all.Queries o.Tags = all.Tags o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_security_monitoring_signal_rule_query.go b/api/datadogV2/model_security_monitoring_signal_rule_query.go index 034edee1075..c81e7ad8af2 100644 --- a/api/datadogV2/model_security_monitoring_signal_rule_query.go +++ b/api/datadogV2/model_security_monitoring_signal_rule_query.go @@ -243,26 +243,15 @@ func (o SecurityMonitoringSignalRuleQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalRuleQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - RuleId *string `json:"ruleId"` - }{} all := struct { Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` CorrelatedByFields []string `json:"correlatedByFields,omitempty"` CorrelatedQueryIndex *int32 `json:"correlatedQueryIndex,omitempty"` Metrics []string `json:"metrics,omitempty"` Name *string `json:"name,omitempty"` - RuleId string `json:"ruleId"` + RuleId *string `json:"ruleId"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.RuleId == nil { - return fmt.Errorf("required field ruleId missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -270,6 +259,9 @@ func (o *SecurityMonitoringSignalRuleQuery) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.RuleId == nil { + return fmt.Errorf("required field ruleId missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "correlatedByFields", "correlatedQueryIndex", "metrics", "name", "ruleId"}) @@ -289,7 +281,7 @@ func (o *SecurityMonitoringSignalRuleQuery) UnmarshalJSON(bytes []byte) (err err o.CorrelatedQueryIndex = all.CorrelatedQueryIndex o.Metrics = all.Metrics o.Name = all.Name - o.RuleId = all.RuleId + o.RuleId = *all.RuleId if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_rule_response.go b/api/datadogV2/model_security_monitoring_signal_rule_response.go index aefe0f9797a..1186eb3c188 100644 --- a/api/datadogV2/model_security_monitoring_signal_rule_response.go +++ b/api/datadogV2/model_security_monitoring_signal_rule_response.go @@ -664,8 +664,7 @@ func (o *SecurityMonitoringSignalRuleResponse) UnmarshalJSON(bytes []byte) (err UpdateAuthorId *int64 `json:"updateAuthorId,omitempty"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_rule_response_query.go b/api/datadogV2/model_security_monitoring_signal_rule_response_query.go index 3932d1866bd..f41049b704a 100644 --- a/api/datadogV2/model_security_monitoring_signal_rule_response_query.go +++ b/api/datadogV2/model_security_monitoring_signal_rule_response_query.go @@ -290,8 +290,7 @@ func (o *SecurityMonitoringSignalRuleResponseQuery) UnmarshalJSON(bytes []byte) Name *string `json:"name,omitempty"` RuleId *string `json:"ruleId,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go b/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go index 6cb127bf056..bc3b17b6ad0 100644 --- a/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go +++ b/api/datadogV2/model_security_monitoring_signal_state_update_attributes.go @@ -177,24 +177,13 @@ func (o SecurityMonitoringSignalStateUpdateAttributes) MarshalJSON() ([]byte, er // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - State *SecurityMonitoringSignalState `json:"state"` - }{} all := struct { ArchiveComment *string `json:"archive_comment,omitempty"` ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` - State SecurityMonitoringSignalState `json:"state"` + State *SecurityMonitoringSignalState `json:"state"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.State == nil { - return fmt.Errorf("required field state missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +191,9 @@ func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []by o.UnparsedObject = raw return nil } + if all.State == nil { + return fmt.Errorf("required field state missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"archive_comment", "archive_reason", "state", "version"}) @@ -226,7 +218,7 @@ func (o *SecurityMonitoringSignalStateUpdateAttributes) UnmarshalJSON(bytes []by } o.ArchiveComment = all.ArchiveComment o.ArchiveReason = all.ArchiveReason - o.State = all.State + o.State = *all.State o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_security_monitoring_signal_state_update_data.go b/api/datadogV2/model_security_monitoring_signal_state_update_data.go index 93c5a7d1668..da36a011395 100644 --- a/api/datadogV2/model_security_monitoring_signal_state_update_data.go +++ b/api/datadogV2/model_security_monitoring_signal_state_update_data.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalStateUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalStateUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` - }{} all := struct { - Attributes SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` + Attributes *SecurityMonitoringSignalStateUpdateAttributes `json:"attributes"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalStateUpdateData) UnmarshalJSON(bytes []byte) (e o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalStateUpdateData) UnmarshalJSON(bytes []byte) (e } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_state_update_request.go b/api/datadogV2/model_security_monitoring_signal_state_update_request.go index bf1faffa14a..572ed628225 100644 --- a/api/datadogV2/model_security_monitoring_signal_state_update_request.go +++ b/api/datadogV2/model_security_monitoring_signal_state_update_request.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalStateUpdateRequest) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalStateUpdateData `json:"data"` - }{} all := struct { - Data SecurityMonitoringSignalStateUpdateData `json:"data"` + Data *SecurityMonitoringSignalStateUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalStateUpdateRequest) UnmarshalJSON(bytes []byte) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signal_triage_attributes.go b/api/datadogV2/model_security_monitoring_signal_triage_attributes.go index 2cba49eb7a9..61dac093af3 100644 --- a/api/datadogV2/model_security_monitoring_signal_triage_attributes.go +++ b/api/datadogV2/model_security_monitoring_signal_triage_attributes.go @@ -330,37 +330,18 @@ func (o SecurityMonitoringSignalTriageAttributes) MarshalJSON() ([]byte, error) // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Assignee *SecurityMonitoringTriageUser `json:"assignee"` - IncidentIds *[]int64 `json:"incident_ids"` - State *SecurityMonitoringSignalState `json:"state"` - }{} all := struct { ArchiveComment *string `json:"archive_comment,omitempty"` ArchiveCommentTimestamp *int64 `json:"archive_comment_timestamp,omitempty"` ArchiveCommentUser *SecurityMonitoringTriageUser `json:"archive_comment_user,omitempty"` ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` - Assignee SecurityMonitoringTriageUser `json:"assignee"` - IncidentIds []int64 `json:"incident_ids"` - State SecurityMonitoringSignalState `json:"state"` + Assignee *SecurityMonitoringTriageUser `json:"assignee"` + IncidentIds *[]int64 `json:"incident_ids"` + State *SecurityMonitoringSignalState `json:"state"` StateUpdateTimestamp *int64 `json:"state_update_timestamp,omitempty"` StateUpdateUser *SecurityMonitoringTriageUser `json:"state_update_user,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Assignee == nil { - return fmt.Errorf("required field assignee missing") - } - if required.IncidentIds == nil { - return fmt.Errorf("required field incident_ids missing") - } - if required.State == nil { - return fmt.Errorf("required field state missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -368,6 +349,15 @@ func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) ( o.UnparsedObject = raw return nil } + if all.Assignee == nil { + return fmt.Errorf("required field assignee missing") + } + if all.IncidentIds == nil { + return fmt.Errorf("required field incident_ids missing") + } + if all.State == nil { + return fmt.Errorf("required field state missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"archive_comment", "archive_comment_timestamp", "archive_comment_user", "archive_reason", "assignee", "incident_ids", "state", "state_update_timestamp", "state_update_user"}) @@ -408,9 +398,9 @@ func (o *SecurityMonitoringSignalTriageAttributes) UnmarshalJSON(bytes []byte) ( } o.UnparsedObject = raw } - o.Assignee = all.Assignee - o.IncidentIds = all.IncidentIds - o.State = all.State + o.Assignee = *all.Assignee + o.IncidentIds = *all.IncidentIds + o.State = *all.State o.StateUpdateTimestamp = all.StateUpdateTimestamp if all.StateUpdateUser != nil && all.StateUpdateUser.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) diff --git a/api/datadogV2/model_security_monitoring_signal_triage_update_data.go b/api/datadogV2/model_security_monitoring_signal_triage_update_data.go index 81b51065197..2ce09fc05ab 100644 --- a/api/datadogV2/model_security_monitoring_signal_triage_update_data.go +++ b/api/datadogV2/model_security_monitoring_signal_triage_update_data.go @@ -86,8 +86,7 @@ func (o *SecurityMonitoringSignalTriageUpdateData) UnmarshalJSON(bytes []byte) ( all := struct { Attributes *SecurityMonitoringSignalTriageAttributes `json:"attributes,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signal_triage_update_response.go b/api/datadogV2/model_security_monitoring_signal_triage_update_response.go index caedd64be90..8211d0206c2 100644 --- a/api/datadogV2/model_security_monitoring_signal_triage_update_response.go +++ b/api/datadogV2/model_security_monitoring_signal_triage_update_response.go @@ -78,21 +78,10 @@ func (o SecurityMonitoringSignalTriageUpdateResponse) MarshalJSON() ([]byte, err // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SecurityMonitoringSignalTriageUpdateData `json:"data"` - }{} all := struct { - Data SecurityMonitoringSignalTriageUpdateData `json:"data"` + Data *SecurityMonitoringSignalTriageUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byt o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SecurityMonitoringSignalTriageUpdateResponse) UnmarshalJSON(bytes []byt } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_signals_list_response.go b/api/datadogV2/model_security_monitoring_signals_list_response.go index 92d934f0512..593a3eec412 100644 --- a/api/datadogV2/model_security_monitoring_signals_list_response.go +++ b/api/datadogV2/model_security_monitoring_signals_list_response.go @@ -155,8 +155,7 @@ func (o *SecurityMonitoringSignalsListResponse) UnmarshalJSON(bytes []byte) (err Links *SecurityMonitoringSignalsListResponseLinks `json:"links,omitempty"` Meta *SecurityMonitoringSignalsListResponseMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signals_list_response_links.go b/api/datadogV2/model_security_monitoring_signals_list_response_links.go index e4e76244ed4..3294c0722fd 100644 --- a/api/datadogV2/model_security_monitoring_signals_list_response_links.go +++ b/api/datadogV2/model_security_monitoring_signals_list_response_links.go @@ -87,8 +87,7 @@ func (o *SecurityMonitoringSignalsListResponseLinks) UnmarshalJSON(bytes []byte) all := struct { Next *string `json:"next,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signals_list_response_meta.go b/api/datadogV2/model_security_monitoring_signals_list_response_meta.go index b8949d1de92..4497bd7c176 100644 --- a/api/datadogV2/model_security_monitoring_signals_list_response_meta.go +++ b/api/datadogV2/model_security_monitoring_signals_list_response_meta.go @@ -86,8 +86,7 @@ func (o *SecurityMonitoringSignalsListResponseMeta) UnmarshalJSON(bytes []byte) all := struct { Page *SecurityMonitoringSignalsListResponseMetaPage `json:"page,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go b/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go index e8f223f7b2e..f148a9e82f8 100644 --- a/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go +++ b/api/datadogV2/model_security_monitoring_signals_list_response_meta_page.go @@ -87,8 +87,7 @@ func (o *SecurityMonitoringSignalsListResponseMetaPage) UnmarshalJSON(bytes []by all := struct { After *string `json:"after,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go b/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go index 7232e626a87..8b57b034faa 100644 --- a/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go +++ b/api/datadogV2/model_security_monitoring_standard_rule_create_payload.go @@ -345,57 +345,44 @@ func (o SecurityMonitoringStandardRuleCreatePayload) MarshalJSON() ([]byte, erro // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` - IsEnabled *bool `json:"isEnabled"` - Message *string `json:"message"` - Name *string `json:"name"` - Options *SecurityMonitoringRuleOptions `json:"options"` - Queries *[]SecurityMonitoringStandardRuleQuery `json:"queries"` - }{} all := struct { - Cases []SecurityMonitoringRuleCaseCreate `json:"cases"` - Filters []SecurityMonitoringFilter `json:"filters,omitempty"` - HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` - IsEnabled bool `json:"isEnabled"` - Message string `json:"message"` - Name string `json:"name"` - Options SecurityMonitoringRuleOptions `json:"options"` - Queries []SecurityMonitoringStandardRuleQuery `json:"queries"` - Tags []string `json:"tags,omitempty"` - Type *SecurityMonitoringRuleTypeCreate `json:"type,omitempty"` + Cases *[]SecurityMonitoringRuleCaseCreate `json:"cases"` + Filters []SecurityMonitoringFilter `json:"filters,omitempty"` + HasExtendedTitle *bool `json:"hasExtendedTitle,omitempty"` + IsEnabled *bool `json:"isEnabled"` + Message *string `json:"message"` + Name *string `json:"name"` + Options *SecurityMonitoringRuleOptions `json:"options"` + Queries *[]SecurityMonitoringStandardRuleQuery `json:"queries"` + Tags []string `json:"tags,omitempty"` + Type *SecurityMonitoringRuleTypeCreate `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err + if err = json.Unmarshal(bytes, &all); err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil } - if required.Cases == nil { + if all.Cases == nil { return fmt.Errorf("required field cases missing") } - if required.IsEnabled == nil { + if all.IsEnabled == nil { return fmt.Errorf("required field isEnabled missing") } - if required.Message == nil { + if all.Message == nil { return fmt.Errorf("required field message missing") } - if required.Name == nil { + if all.Name == nil { return fmt.Errorf("required field name missing") } - if required.Options == nil { + if all.Options == nil { return fmt.Errorf("required field options missing") } - if required.Queries == nil { + if all.Queries == nil { return fmt.Errorf("required field queries missing") } - err = json.Unmarshal(bytes, &all) - if err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"cases", "filters", "hasExtendedTitle", "isEnabled", "message", "name", "options", "queries", "tags", "type"}) @@ -410,12 +397,12 @@ func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte o.UnparsedObject = raw return nil } - o.Cases = all.Cases + o.Cases = *all.Cases o.Filters = all.Filters o.HasExtendedTitle = all.HasExtendedTitle - o.IsEnabled = all.IsEnabled - o.Message = all.Message - o.Name = all.Name + o.IsEnabled = *all.IsEnabled + o.Message = *all.Message + o.Name = *all.Name if all.Options.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -423,8 +410,8 @@ func (o *SecurityMonitoringStandardRuleCreatePayload) UnmarshalJSON(bytes []byte } o.UnparsedObject = raw } - o.Options = all.Options - o.Queries = all.Queries + o.Options = *all.Options + o.Queries = *all.Queries o.Tags = all.Tags o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_security_monitoring_standard_rule_query.go b/api/datadogV2/model_security_monitoring_standard_rule_query.go index 624800330f3..a722641c161 100644 --- a/api/datadogV2/model_security_monitoring_standard_rule_query.go +++ b/api/datadogV2/model_security_monitoring_standard_rule_query.go @@ -281,9 +281,6 @@ func (o SecurityMonitoringStandardRuleQuery) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringStandardRuleQuery) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Query *string `json:"query"` - }{} all := struct { Aggregation *SecurityMonitoringRuleQueryAggregation `json:"aggregation,omitempty"` DistinctFields []string `json:"distinctFields,omitempty"` @@ -291,17 +288,9 @@ func (o *SecurityMonitoringStandardRuleQuery) UnmarshalJSON(bytes []byte) (err e Metric *string `json:"metric,omitempty"` Metrics []string `json:"metrics,omitempty"` Name *string `json:"name,omitempty"` - Query string `json:"query"` + Query *string `json:"query"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Query == nil { - return fmt.Errorf("required field query missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -309,6 +298,9 @@ func (o *SecurityMonitoringStandardRuleQuery) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation", "distinctFields", "groupByFields", "metric", "metrics", "name", "query"}) @@ -329,7 +321,7 @@ func (o *SecurityMonitoringStandardRuleQuery) UnmarshalJSON(bytes []byte) (err e o.Metric = all.Metric o.Metrics = all.Metrics o.Name = all.Name - o.Query = all.Query + o.Query = *all.Query if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_security_monitoring_standard_rule_response.go b/api/datadogV2/model_security_monitoring_standard_rule_response.go index 277702db8fb..4e1cbcc0fa1 100644 --- a/api/datadogV2/model_security_monitoring_standard_rule_response.go +++ b/api/datadogV2/model_security_monitoring_standard_rule_response.go @@ -698,8 +698,7 @@ func (o *SecurityMonitoringStandardRuleResponse) UnmarshalJSON(bytes []byte) (er UpdateAuthorId *int64 `json:"updateAuthorId,omitempty"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_security_monitoring_triage_user.go b/api/datadogV2/model_security_monitoring_triage_user.go index 80bc46aa485..aa52c996c06 100644 --- a/api/datadogV2/model_security_monitoring_triage_user.go +++ b/api/datadogV2/model_security_monitoring_triage_user.go @@ -188,24 +188,13 @@ func (o SecurityMonitoringTriageUser) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SecurityMonitoringTriageUser) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Uuid *string `json:"uuid"` - }{} all := struct { Handle *string `json:"handle,omitempty"` Id *int64 `json:"id,omitempty"` Name datadog.NullableString `json:"name,omitempty"` - Uuid string `json:"uuid"` + Uuid *string `json:"uuid"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Uuid == nil { - return fmt.Errorf("required field uuid missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -213,6 +202,9 @@ func (o *SecurityMonitoringTriageUser) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"handle", "id", "name", "uuid"}) @@ -222,7 +214,7 @@ func (o *SecurityMonitoringTriageUser) UnmarshalJSON(bytes []byte) (err error) { o.Handle = all.Handle o.Id = all.Id o.Name = all.Name - o.Uuid = all.Uuid + o.Uuid = *all.Uuid if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_config_request.go b/api/datadogV2/model_sensitive_data_scanner_config_request.go index 3127e5b412c..acf9363b02e 100644 --- a/api/datadogV2/model_sensitive_data_scanner_config_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_config_request.go @@ -105,26 +105,11 @@ func (o SensitiveDataScannerConfigRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerConfigRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Data *SensitiveDataScannerReorderConfig `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} - all := struct { - Data SensitiveDataScannerReorderConfig `json:"data"` - Meta SensitiveDataScannerMetaVersionOnly `json:"meta"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SensitiveDataScannerConfigRequest) UnmarshalJSON(bytes []byte) (err err o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) @@ -145,7 +136,7 @@ func (o *SensitiveDataScannerConfigRequest) UnmarshalJSON(bytes []byte) (err err } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -153,7 +144,7 @@ func (o *SensitiveDataScannerConfigRequest) UnmarshalJSON(bytes []byte) (err err } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_configuration.go b/api/datadogV2/model_sensitive_data_scanner_configuration.go index 0e4385a3602..99c79dcf6b7 100644 --- a/api/datadogV2/model_sensitive_data_scanner_configuration.go +++ b/api/datadogV2/model_sensitive_data_scanner_configuration.go @@ -124,8 +124,7 @@ func (o *SensitiveDataScannerConfiguration) UnmarshalJSON(bytes []byte) (err err Id *string `json:"id,omitempty"` Type *SensitiveDataScannerConfigurationType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_configuration_data.go b/api/datadogV2/model_sensitive_data_scanner_configuration_data.go index 0dab5a09eea..be363033063 100644 --- a/api/datadogV2/model_sensitive_data_scanner_configuration_data.go +++ b/api/datadogV2/model_sensitive_data_scanner_configuration_data.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerConfigurationData) UnmarshalJSON(bytes []byte) (err all := struct { Data *SensitiveDataScannerConfiguration `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go b/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go index 187c3f7b3b5..943cf735501 100644 --- a/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go +++ b/api/datadogV2/model_sensitive_data_scanner_configuration_relationships.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerConfigurationRelationships) UnmarshalJSON(bytes []b all := struct { Groups *SensitiveDataScannerGroupList `json:"groups,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_create_group_response.go b/api/datadogV2/model_sensitive_data_scanner_create_group_response.go index d386b5556a8..3a8422e4c3d 100644 --- a/api/datadogV2/model_sensitive_data_scanner_create_group_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_create_group_response.go @@ -120,8 +120,7 @@ func (o *SensitiveDataScannerCreateGroupResponse) UnmarshalJSON(bytes []byte) (e Data *SensitiveDataScannerGroupResponse `json:"data,omitempty"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go b/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go index acacb213617..776be8ccb8f 100644 --- a/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_create_rule_response.go @@ -120,8 +120,7 @@ func (o *SensitiveDataScannerCreateRuleResponse) UnmarshalJSON(bytes []byte) (er Data *SensitiveDataScannerRuleResponse `json:"data,omitempty"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_filter.go b/api/datadogV2/model_sensitive_data_scanner_filter.go index cc6bb037b79..13b998094fc 100644 --- a/api/datadogV2/model_sensitive_data_scanner_filter.go +++ b/api/datadogV2/model_sensitive_data_scanner_filter.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_get_config_response.go b/api/datadogV2/model_sensitive_data_scanner_get_config_response.go index 4f4a6a5b1bd..a87e2480504 100644 --- a/api/datadogV2/model_sensitive_data_scanner_get_config_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_get_config_response.go @@ -154,8 +154,7 @@ func (o *SensitiveDataScannerGetConfigResponse) UnmarshalJSON(bytes []byte) (err Included []SensitiveDataScannerGetConfigIncludedItem `json:"included,omitempty"` Meta *SensitiveDataScannerMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go b/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go index 6ff4fa6958c..a3c9028229c 100644 --- a/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go +++ b/api/datadogV2/model_sensitive_data_scanner_get_config_response_data.go @@ -158,8 +158,7 @@ func (o *SensitiveDataScannerGetConfigResponseData) UnmarshalJSON(bytes []byte) Relationships *SensitiveDataScannerConfigurationRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerConfigurationType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group.go b/api/datadogV2/model_sensitive_data_scanner_group.go index a7ca9d6b843..d2413168a89 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group.go +++ b/api/datadogV2/model_sensitive_data_scanner_group.go @@ -124,8 +124,7 @@ func (o *SensitiveDataScannerGroup) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_attributes.go b/api/datadogV2/model_sensitive_data_scanner_group_attributes.go index 5e7588cd3aa..d9a8cc90085 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_attributes.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_attributes.go @@ -222,8 +222,7 @@ func (o *SensitiveDataScannerGroupAttributes) UnmarshalJSON(bytes []byte) (err e Name *string `json:"name,omitempty"` ProductList []SensitiveDataScannerProduct `json:"product_list,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_create.go b/api/datadogV2/model_sensitive_data_scanner_group_create.go index cbe75c24f5a..2a263eeb5a1 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_create.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_create.go @@ -140,27 +140,12 @@ func (o SensitiveDataScannerGroupCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *SensitiveDataScannerGroupAttributes `json:"attributes"` - Type *SensitiveDataScannerGroupType `json:"type"` - }{} all := struct { - Attributes SensitiveDataScannerGroupAttributes `json:"attributes"` + Attributes *SensitiveDataScannerGroupAttributes `json:"attributes"` Relationships *SensitiveDataScannerGroupRelationships `json:"relationships,omitempty"` - Type SensitiveDataScannerGroupType `json:"type"` + Type *SensitiveDataScannerGroupType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *SensitiveDataScannerGroupCreate) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -189,7 +180,7 @@ func (o *SensitiveDataScannerGroupCreate) UnmarshalJSON(bytes []byte) (err error } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -198,7 +189,7 @@ func (o *SensitiveDataScannerGroupCreate) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_group_create_request.go b/api/datadogV2/model_sensitive_data_scanner_group_create_request.go index 1bd447da958..de38663f623 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_create_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_create_request.go @@ -120,8 +120,7 @@ func (o *SensitiveDataScannerGroupCreateRequest) UnmarshalJSON(bytes []byte) (er Data *SensitiveDataScannerGroupCreate `json:"data,omitempty"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_data.go b/api/datadogV2/model_sensitive_data_scanner_group_data.go index db609c7b373..bfa3c42a9e8 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_data.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_data.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerGroupData) UnmarshalJSON(bytes []byte) (err error) all := struct { Data *SensitiveDataScannerGroup `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go b/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go index 798ec448c5a..60972419650 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_delete_request.go @@ -78,21 +78,10 @@ func (o SensitiveDataScannerGroupDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` - }{} all := struct { - Meta SensitiveDataScannerMetaVersionOnly `json:"meta"` + Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SensitiveDataScannerGroupDeleteRequest) UnmarshalJSON(bytes []byte) (er o.UnparsedObject = raw return nil } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"meta"}) @@ -113,7 +105,7 @@ func (o *SensitiveDataScannerGroupDeleteRequest) UnmarshalJSON(bytes []byte) (er } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go b/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go index 510d8efdffd..6a463134bab 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_delete_response.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerGroupDeleteResponse) UnmarshalJSON(bytes []byte) (e all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_included_item.go b/api/datadogV2/model_sensitive_data_scanner_group_included_item.go index 49f95d0de5b..628152a000d 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_included_item.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_included_item.go @@ -192,8 +192,7 @@ func (o *SensitiveDataScannerGroupIncludedItem) UnmarshalJSON(bytes []byte) (err Relationships *SensitiveDataScannerGroupRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_item.go b/api/datadogV2/model_sensitive_data_scanner_group_item.go index d3e932be5d4..e247a1eee6b 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_item.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_item.go @@ -124,8 +124,7 @@ func (o *SensitiveDataScannerGroupItem) UnmarshalJSON(bytes []byte) (err error) Id *string `json:"id,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_list.go b/api/datadogV2/model_sensitive_data_scanner_group_list.go index 9ee32041f04..b53a8c9b8bf 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_list.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_list.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerGroupList) UnmarshalJSON(bytes []byte) (err error) all := struct { Data []SensitiveDataScannerGroupItem `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_relationships.go b/api/datadogV2/model_sensitive_data_scanner_group_relationships.go index 5d097e2b349..554629294ab 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_relationships.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_relationships.go @@ -120,8 +120,7 @@ func (o *SensitiveDataScannerGroupRelationships) UnmarshalJSON(bytes []byte) (er Configuration *SensitiveDataScannerConfigurationData `json:"configuration,omitempty"` Rules *SensitiveDataScannerRuleData `json:"rules,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_response.go b/api/datadogV2/model_sensitive_data_scanner_group_response.go index bed9e2dd305..ac390bb0cda 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_response.go @@ -192,8 +192,7 @@ func (o *SensitiveDataScannerGroupResponse) UnmarshalJSON(bytes []byte) (err err Relationships *SensitiveDataScannerGroupRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_update.go b/api/datadogV2/model_sensitive_data_scanner_group_update.go index e030b0ce6fb..27b9ce60acc 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_update.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_update.go @@ -192,8 +192,7 @@ func (o *SensitiveDataScannerGroupUpdate) UnmarshalJSON(bytes []byte) (err error Relationships *SensitiveDataScannerGroupRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerGroupType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_group_update_request.go b/api/datadogV2/model_sensitive_data_scanner_group_update_request.go index 91dde98306f..1348ee4de30 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_update_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_update_request.go @@ -105,26 +105,11 @@ func (o SensitiveDataScannerGroupUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerGroupUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Data *SensitiveDataScannerGroupUpdate `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} - all := struct { - Data SensitiveDataScannerGroupUpdate `json:"data"` - Meta SensitiveDataScannerMetaVersionOnly `json:"meta"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SensitiveDataScannerGroupUpdateRequest) UnmarshalJSON(bytes []byte) (er o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) @@ -145,7 +136,7 @@ func (o *SensitiveDataScannerGroupUpdateRequest) UnmarshalJSON(bytes []byte) (er } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -153,7 +144,7 @@ func (o *SensitiveDataScannerGroupUpdateRequest) UnmarshalJSON(bytes []byte) (er } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_group_update_response.go b/api/datadogV2/model_sensitive_data_scanner_group_update_response.go index 417a5b44119..0cb199e408c 100644 --- a/api/datadogV2/model_sensitive_data_scanner_group_update_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_group_update_response.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerGroupUpdateResponse) UnmarshalJSON(bytes []byte) (e all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_meta.go b/api/datadogV2/model_sensitive_data_scanner_meta.go index 4159d935549..2d26a01c4a9 100644 --- a/api/datadogV2/model_sensitive_data_scanner_meta.go +++ b/api/datadogV2/model_sensitive_data_scanner_meta.go @@ -222,8 +222,7 @@ func (o *SensitiveDataScannerMeta) UnmarshalJSON(bytes []byte) (err error) { IsPciCompliant *bool `json:"is_pci_compliant,omitempty"` Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go b/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go index 0f9d70a0590..0bc42821f4d 100644 --- a/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go +++ b/api/datadogV2/model_sensitive_data_scanner_meta_version_only.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerMetaVersionOnly) UnmarshalJSON(bytes []byte) (err e all := struct { Version *int64 `json:"version,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_reorder_config.go b/api/datadogV2/model_sensitive_data_scanner_reorder_config.go index 0e7fcea2401..2069611c955 100644 --- a/api/datadogV2/model_sensitive_data_scanner_reorder_config.go +++ b/api/datadogV2/model_sensitive_data_scanner_reorder_config.go @@ -158,8 +158,7 @@ func (o *SensitiveDataScannerReorderConfig) UnmarshalJSON(bytes []byte) (err err Relationships *SensitiveDataScannerConfigurationRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerConfigurationType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go b/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go index a266e97953f..037dc29ab0d 100644 --- a/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_reorder_groups_response.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerReorderGroupsResponse) UnmarshalJSON(bytes []byte) all := struct { Meta *SensitiveDataScannerMeta `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule.go b/api/datadogV2/model_sensitive_data_scanner_rule.go index 03084b08b37..c5b503e6fca 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule.go @@ -124,8 +124,7 @@ func (o *SensitiveDataScannerRule) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go b/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go index f3c2aabec51..d7d879334b4 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_attributes.go @@ -325,8 +325,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er Tags []string `json:"tags,omitempty"` TextReplacement *SensitiveDataScannerTextReplacement `json:"text_replacement,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_create.go b/api/datadogV2/model_sensitive_data_scanner_rule_create.go index c159af6750b..0b18c6d1b64 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_create.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_create.go @@ -134,31 +134,12 @@ func (o SensitiveDataScannerRuleCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *SensitiveDataScannerRuleAttributes `json:"attributes"` Relationships *SensitiveDataScannerRuleRelationships `json:"relationships"` Type *SensitiveDataScannerRuleType `json:"type"` }{} - all := struct { - Attributes SensitiveDataScannerRuleAttributes `json:"attributes"` - Relationships SensitiveDataScannerRuleRelationships `json:"relationships"` - Type SensitiveDataScannerRuleType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Relationships == nil { - return fmt.Errorf("required field relationships missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *SensitiveDataScannerRuleCreate) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -187,7 +177,7 @@ func (o *SensitiveDataScannerRuleCreate) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -195,8 +185,8 @@ func (o *SensitiveDataScannerRuleCreate) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Relationships = all.Relationships - o.Type = all.Type + o.Relationships = *all.Relationships + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go b/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go index 77d3f776fd1..90e9deea277 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_create_request.go @@ -105,26 +105,11 @@ func (o SensitiveDataScannerRuleCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Data *SensitiveDataScannerRuleCreate `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} - all := struct { - Data SensitiveDataScannerRuleCreate `json:"data"` - Meta SensitiveDataScannerMetaVersionOnly `json:"meta"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SensitiveDataScannerRuleCreateRequest) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) @@ -145,7 +136,7 @@ func (o *SensitiveDataScannerRuleCreateRequest) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -153,7 +144,7 @@ func (o *SensitiveDataScannerRuleCreateRequest) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_data.go b/api/datadogV2/model_sensitive_data_scanner_rule_data.go index d39eb936e67..33dece9eab4 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_data.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_data.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerRuleData) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []SensitiveDataScannerRule `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go b/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go index 9ae602adf17..c0d3ad3aee3 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_delete_request.go @@ -78,21 +78,10 @@ func (o SensitiveDataScannerRuleDeleteRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` - }{} all := struct { - Meta SensitiveDataScannerMetaVersionOnly `json:"meta"` + Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SensitiveDataScannerRuleDeleteRequest) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"meta"}) @@ -113,7 +105,7 @@ func (o *SensitiveDataScannerRuleDeleteRequest) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go b/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go index c97e2db2363..b2c4b2cb9e8 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_delete_response.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerRuleDeleteResponse) UnmarshalJSON(bytes []byte) (er all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go b/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go index df3fc3e8c28..9f39c74e034 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_included_item.go @@ -192,8 +192,7 @@ func (o *SensitiveDataScannerRuleIncludedItem) UnmarshalJSON(bytes []byte) (err Relationships *SensitiveDataScannerRuleRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go b/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go index ebb0d4b0a9e..464e818df53 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_relationships.go @@ -120,8 +120,7 @@ func (o *SensitiveDataScannerRuleRelationships) UnmarshalJSON(bytes []byte) (err Group *SensitiveDataScannerGroupData `json:"group,omitempty"` StandardPattern *SensitiveDataScannerStandardPatternData `json:"standard_pattern,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_response.go b/api/datadogV2/model_sensitive_data_scanner_rule_response.go index 3aa08cf2e02..5ce56a6c605 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_response.go @@ -192,8 +192,7 @@ func (o *SensitiveDataScannerRuleResponse) UnmarshalJSON(bytes []byte) (err erro Relationships *SensitiveDataScannerRuleRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_update.go b/api/datadogV2/model_sensitive_data_scanner_rule_update.go index 7e92f9f2d20..fbf1261b0d4 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_update.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_update.go @@ -192,8 +192,7 @@ func (o *SensitiveDataScannerRuleUpdate) UnmarshalJSON(bytes []byte) (err error) Relationships *SensitiveDataScannerRuleRelationships `json:"relationships,omitempty"` Type *SensitiveDataScannerRuleType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go b/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go index d499ffab4b7..3396c31e364 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_update_request.go @@ -105,26 +105,11 @@ func (o SensitiveDataScannerRuleUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SensitiveDataScannerRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Data *SensitiveDataScannerRuleUpdate `json:"data"` Meta *SensitiveDataScannerMetaVersionOnly `json:"meta"` }{} - all := struct { - Data SensitiveDataScannerRuleUpdate `json:"data"` - Meta SensitiveDataScannerMetaVersionOnly `json:"meta"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - if required.Meta == nil { - return fmt.Errorf("required field meta missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -132,6 +117,12 @@ func (o *SensitiveDataScannerRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + if all.Meta == nil { + return fmt.Errorf("required field meta missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) @@ -145,7 +136,7 @@ func (o *SensitiveDataScannerRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -153,7 +144,7 @@ func (o *SensitiveDataScannerRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err } o.UnparsedObject = raw } - o.Meta = all.Meta + o.Meta = *all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go b/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go index a59183381eb..96a5c76cb98 100644 --- a/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go +++ b/api/datadogV2/model_sensitive_data_scanner_rule_update_response.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerRuleUpdateResponse) UnmarshalJSON(bytes []byte) (er all := struct { Meta *SensitiveDataScannerMetaVersionOnly `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go b/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go index 2e479511465..993ab08537e 100644 --- a/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go +++ b/api/datadogV2/model_sensitive_data_scanner_standard_pattern.go @@ -124,8 +124,7 @@ func (o *SensitiveDataScannerStandardPattern) UnmarshalJSON(bytes []byte) (err e Id *string `json:"id,omitempty"` Type *SensitiveDataScannerStandardPatternType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go b/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go index 2f2bafdebce..632c334422b 100644 --- a/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go +++ b/api/datadogV2/model_sensitive_data_scanner_standard_pattern_attributes.go @@ -154,8 +154,7 @@ func (o *SensitiveDataScannerStandardPatternAttributes) UnmarshalJSON(bytes []by Pattern *string `json:"pattern,omitempty"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go b/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go index fadc90e980a..ffa22ece5f0 100644 --- a/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go +++ b/api/datadogV2/model_sensitive_data_scanner_standard_pattern_data.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerStandardPatternData) UnmarshalJSON(bytes []byte) (e all := struct { Data *SensitiveDataScannerStandardPattern `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go b/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go index 6c4eba877c3..c39f22ec7cc 100644 --- a/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go +++ b/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_data.go @@ -86,8 +86,7 @@ func (o *SensitiveDataScannerStandardPatternsResponseData) UnmarshalJSON(bytes [ all := struct { Data []SensitiveDataScannerStandardPatternsResponseItem `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go b/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go index 4980ad5b579..0ba301d8f9d 100644 --- a/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go +++ b/api/datadogV2/model_sensitive_data_scanner_standard_patterns_response_item.go @@ -158,8 +158,7 @@ func (o *SensitiveDataScannerStandardPatternsResponseItem) UnmarshalJSON(bytes [ Id *string `json:"id,omitempty"` Type *SensitiveDataScannerStandardPatternType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_sensitive_data_scanner_text_replacement.go b/api/datadogV2/model_sensitive_data_scanner_text_replacement.go index 470d35d82c0..04f62a27935 100644 --- a/api/datadogV2/model_sensitive_data_scanner_text_replacement.go +++ b/api/datadogV2/model_sensitive_data_scanner_text_replacement.go @@ -164,8 +164,7 @@ func (o *SensitiveDataScannerTextReplacement) UnmarshalJSON(bytes []byte) (err e ReplacementString *string `json:"replacement_string,omitempty"` Type *SensitiveDataScannerTextReplacementType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_account_create_attributes.go b/api/datadogV2/model_service_account_create_attributes.go index 60d0947b5c6..fd8a284b960 100644 --- a/api/datadogV2/model_service_account_create_attributes.go +++ b/api/datadogV2/model_service_account_create_attributes.go @@ -171,28 +171,13 @@ func (o ServiceAccountCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Email *string `json:"email"` - ServiceAccount *bool `json:"service_account"` - }{} all := struct { - Email string `json:"email"` + Email *string `json:"email"` Name *string `json:"name,omitempty"` - ServiceAccount bool `json:"service_account"` + ServiceAccount *bool `json:"service_account"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Email == nil { - return fmt.Errorf("required field email missing") - } - if required.ServiceAccount == nil { - return fmt.Errorf("required field service_account missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,15 +185,21 @@ func (o *ServiceAccountCreateAttributes) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Email == nil { + return fmt.Errorf("required field email missing") + } + if all.ServiceAccount == nil { + return fmt.Errorf("required field service_account missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"email", "name", "service_account", "title"}) } else { return err } - o.Email = all.Email + o.Email = *all.Email o.Name = all.Name - o.ServiceAccount = all.ServiceAccount + o.ServiceAccount = *all.ServiceAccount o.Title = all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_service_account_create_data.go b/api/datadogV2/model_service_account_create_data.go index 124918f9174..0d60c77a21e 100644 --- a/api/datadogV2/model_service_account_create_data.go +++ b/api/datadogV2/model_service_account_create_data.go @@ -140,27 +140,12 @@ func (o ServiceAccountCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *ServiceAccountCreateAttributes `json:"attributes"` - Type *UsersType `json:"type"` - }{} all := struct { - Attributes ServiceAccountCreateAttributes `json:"attributes"` - Relationships *UserRelationships `json:"relationships,omitempty"` - Type UsersType `json:"type"` + Attributes *ServiceAccountCreateAttributes `json:"attributes"` + Relationships *UserRelationships `json:"relationships,omitempty"` + Type *UsersType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -189,7 +180,7 @@ func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -198,7 +189,7 @@ func (o *ServiceAccountCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_account_create_request.go b/api/datadogV2/model_service_account_create_request.go index 3214fd00edd..27376495dc8 100644 --- a/api/datadogV2/model_service_account_create_request.go +++ b/api/datadogV2/model_service_account_create_request.go @@ -78,21 +78,10 @@ func (o ServiceAccountCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *ServiceAccountCreateData `json:"data"` - }{} all := struct { - Data ServiceAccountCreateData `json:"data"` + Data *ServiceAccountCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *ServiceAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_create_response.go b/api/datadogV2/model_service_definition_create_response.go index a3a93b093ec..d81feb5941b 100644 --- a/api/datadogV2/model_service_definition_create_response.go +++ b/api/datadogV2/model_service_definition_create_response.go @@ -86,8 +86,7 @@ func (o *ServiceDefinitionCreateResponse) UnmarshalJSON(bytes []byte) (err error all := struct { Data []ServiceDefinitionData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_data.go b/api/datadogV2/model_service_definition_data.go index bb03e5f04c3..ac9e0e4c011 100644 --- a/api/datadogV2/model_service_definition_data.go +++ b/api/datadogV2/model_service_definition_data.go @@ -120,8 +120,7 @@ func (o *ServiceDefinitionData) UnmarshalJSON(bytes []byte) (err error) { Attributes *ServiceDefinitionDataAttributes `json:"attributes,omitempty"` Type *string `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_data_attributes.go b/api/datadogV2/model_service_definition_data_attributes.go index 88d0b886584..8fa75d890a0 100644 --- a/api/datadogV2/model_service_definition_data_attributes.go +++ b/api/datadogV2/model_service_definition_data_attributes.go @@ -120,8 +120,7 @@ func (o *ServiceDefinitionDataAttributes) UnmarshalJSON(bytes []byte) (err error Meta *ServiceDefinitionMeta `json:"meta,omitempty"` Schema *ServiceDefinitionSchema `json:"schema,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_get_response.go b/api/datadogV2/model_service_definition_get_response.go index 2ac6aa6ea0c..af8ad68bcd2 100644 --- a/api/datadogV2/model_service_definition_get_response.go +++ b/api/datadogV2/model_service_definition_get_response.go @@ -86,8 +86,7 @@ func (o *ServiceDefinitionGetResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *ServiceDefinitionData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_meta.go b/api/datadogV2/model_service_definition_meta.go index 2d23898619a..60ee534a870 100644 --- a/api/datadogV2/model_service_definition_meta.go +++ b/api/datadogV2/model_service_definition_meta.go @@ -188,8 +188,7 @@ func (o *ServiceDefinitionMeta) UnmarshalJSON(bytes []byte) (err error) { IngestionSource *string `json:"ingestion-source,omitempty"` LastModifiedTime *string `json:"last-modified-time,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v1.go b/api/datadogV2/model_service_definition_v1.go index 045fc7d91f3..66dc444e9eb 100644 --- a/api/datadogV2/model_service_definition_v1.go +++ b/api/datadogV2/model_service_definition_v1.go @@ -307,32 +307,17 @@ func (o ServiceDefinitionV1) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Info *ServiceDefinitionV1Info `json:"info"` - SchemaVersion *ServiceDefinitionV1Version `json:"schema-version"` - }{} all := struct { Contact *ServiceDefinitionV1Contact `json:"contact,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` ExternalResources []ServiceDefinitionV1Resource `json:"external-resources,omitempty"` - Info ServiceDefinitionV1Info `json:"info"` + Info *ServiceDefinitionV1Info `json:"info"` Integrations *ServiceDefinitionV1Integrations `json:"integrations,omitempty"` Org *ServiceDefinitionV1Org `json:"org,omitempty"` - SchemaVersion ServiceDefinitionV1Version `json:"schema-version"` + SchemaVersion *ServiceDefinitionV1Version `json:"schema-version"` Tags []string `json:"tags,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Info == nil { - return fmt.Errorf("required field info missing") - } - if required.SchemaVersion == nil { - return fmt.Errorf("required field schema-version missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -340,6 +325,12 @@ func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Info == nil { + return fmt.Errorf("required field info missing") + } + if all.SchemaVersion == nil { + return fmt.Errorf("required field schema-version missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "extensions", "external-resources", "info", "integrations", "org", "schema-version", "tags"}) @@ -371,7 +362,7 @@ func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Info = all.Info + o.Info = *all.Info if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -388,7 +379,7 @@ func (o *ServiceDefinitionV1) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Org = all.Org - o.SchemaVersion = all.SchemaVersion + o.SchemaVersion = *all.SchemaVersion o.Tags = all.Tags if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_service_definition_v1_contact.go b/api/datadogV2/model_service_definition_v1_contact.go index 9c60ba42b70..c26164af418 100644 --- a/api/datadogV2/model_service_definition_v1_contact.go +++ b/api/datadogV2/model_service_definition_v1_contact.go @@ -120,8 +120,7 @@ func (o *ServiceDefinitionV1Contact) UnmarshalJSON(bytes []byte) (err error) { Email *string `json:"email,omitempty"` Slack *string `json:"slack,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v1_info.go b/api/datadogV2/model_service_definition_v1_info.go index 23558e062e8..3b12377a342 100644 --- a/api/datadogV2/model_service_definition_v1_info.go +++ b/api/datadogV2/model_service_definition_v1_info.go @@ -177,24 +177,13 @@ func (o ServiceDefinitionV1Info) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Info) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DdService *string `json:"dd-service"` - }{} all := struct { - DdService string `json:"dd-service"` + DdService *string `json:"dd-service"` Description *string `json:"description,omitempty"` DisplayName *string `json:"display-name,omitempty"` ServiceTier *string `json:"service-tier,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DdService == nil { - return fmt.Errorf("required field dd-service missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,13 +191,16 @@ func (o *ServiceDefinitionV1Info) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DdService == nil { + return fmt.Errorf("required field dd-service missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"dd-service", "description", "display-name", "service-tier"}) } else { return err } - o.DdService = all.DdService + o.DdService = *all.DdService o.Description = all.Description o.DisplayName = all.DisplayName o.ServiceTier = all.ServiceTier diff --git a/api/datadogV2/model_service_definition_v1_integrations.go b/api/datadogV2/model_service_definition_v1_integrations.go index 5b8f5d61fd8..a1346935411 100644 --- a/api/datadogV2/model_service_definition_v1_integrations.go +++ b/api/datadogV2/model_service_definition_v1_integrations.go @@ -86,8 +86,7 @@ func (o *ServiceDefinitionV1Integrations) UnmarshalJSON(bytes []byte) (err error all := struct { Pagerduty *string `json:"pagerduty,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v1_org.go b/api/datadogV2/model_service_definition_v1_org.go index 70f65fa6d52..f476fcf21c6 100644 --- a/api/datadogV2/model_service_definition_v1_org.go +++ b/api/datadogV2/model_service_definition_v1_org.go @@ -120,8 +120,7 @@ func (o *ServiceDefinitionV1Org) UnmarshalJSON(bytes []byte) (err error) { Application *string `json:"application,omitempty"` Team *string `json:"team,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v1_resource.go b/api/datadogV2/model_service_definition_v1_resource.go index 151320cdb8d..899538de58c 100644 --- a/api/datadogV2/model_service_definition_v1_resource.go +++ b/api/datadogV2/model_service_definition_v1_resource.go @@ -132,31 +132,12 @@ func (o ServiceDefinitionV1Resource) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV1Resource) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Name *string `json:"name"` Type *ServiceDefinitionV1ResourceType `json:"type"` Url *string `json:"url"` }{} - all := struct { - Name string `json:"name"` - Type ServiceDefinitionV1ResourceType `json:"type"` - Url string `json:"url"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -164,6 +145,15 @@ func (o *ServiceDefinitionV1Resource) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "type", "url"}) @@ -178,9 +168,9 @@ func (o *ServiceDefinitionV1Resource) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Name = all.Name - o.Type = all.Type - o.Url = all.Url + o.Name = *all.Name + o.Type = *all.Type + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2.go b/api/datadogV2/model_service_definition_v2.go index 00a56a14885..7924b66dd7a 100644 --- a/api/datadogV2/model_service_definition_v2.go +++ b/api/datadogV2/model_service_definition_v2.go @@ -404,35 +404,20 @@ func (o ServiceDefinitionV2) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DdService *string `json:"dd-service"` - SchemaVersion *ServiceDefinitionV2Version `json:"schema-version"` - }{} all := struct { Contacts []ServiceDefinitionV2Contact `json:"contacts,omitempty"` - DdService string `json:"dd-service"` + DdService *string `json:"dd-service"` DdTeam *string `json:"dd-team,omitempty"` Docs []ServiceDefinitionV2Doc `json:"docs,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` Integrations *ServiceDefinitionV2Integrations `json:"integrations,omitempty"` Links []ServiceDefinitionV2Link `json:"links,omitempty"` Repos []ServiceDefinitionV2Repo `json:"repos,omitempty"` - SchemaVersion ServiceDefinitionV2Version `json:"schema-version"` + SchemaVersion *ServiceDefinitionV2Version `json:"schema-version"` Tags []string `json:"tags,omitempty"` Team *string `json:"team,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DdService == nil { - return fmt.Errorf("required field dd-service missing") - } - if required.SchemaVersion == nil { - return fmt.Errorf("required field schema-version missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -440,6 +425,12 @@ func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DdService == nil { + return fmt.Errorf("required field dd-service missing") + } + if all.SchemaVersion == nil { + return fmt.Errorf("required field schema-version missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contacts", "dd-service", "dd-team", "docs", "extensions", "integrations", "links", "repos", "schema-version", "tags", "team"}) @@ -455,7 +446,7 @@ func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Contacts = all.Contacts - o.DdService = all.DdService + o.DdService = *all.DdService o.DdTeam = all.DdTeam o.Docs = all.Docs o.Extensions = all.Extensions @@ -469,7 +460,7 @@ func (o *ServiceDefinitionV2) UnmarshalJSON(bytes []byte) (err error) { o.Integrations = all.Integrations o.Links = all.Links o.Repos = all.Repos - o.SchemaVersion = all.SchemaVersion + o.SchemaVersion = *all.SchemaVersion o.Tags = all.Tags o.Team = all.Team if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_service_definition_v2_doc.go b/api/datadogV2/model_service_definition_v2_doc.go index 9328a98fbf3..6cfd02148f7 100644 --- a/api/datadogV2/model_service_definition_v2_doc.go +++ b/api/datadogV2/model_service_definition_v2_doc.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Doc) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Doc) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Url *string `json:"url"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` Provider *string `json:"provider,omitempty"` - Url string `json:"url"` + Url *string `json:"url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,15 +151,21 @@ func (o *ServiceDefinitionV2Doc) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "provider", "url"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name o.Provider = all.Provider - o.Url = all.Url + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_dot1.go b/api/datadogV2/model_service_definition_v2_dot1.go index bd879d723a9..ab6c852463f 100644 --- a/api/datadogV2/model_service_definition_v2_dot1.go +++ b/api/datadogV2/model_service_definition_v2_dot1.go @@ -437,36 +437,21 @@ func (o ServiceDefinitionV2Dot1) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - DdService *string `json:"dd-service"` - SchemaVersion *ServiceDefinitionV2Dot1Version `json:"schema-version"` - }{} all := struct { Application *string `json:"application,omitempty"` Contacts []ServiceDefinitionV2Dot1Contact `json:"contacts,omitempty"` - DdService string `json:"dd-service"` + DdService *string `json:"dd-service"` Description *string `json:"description,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` Integrations *ServiceDefinitionV2Dot1Integrations `json:"integrations,omitempty"` Lifecycle *string `json:"lifecycle,omitempty"` Links []ServiceDefinitionV2Dot1Link `json:"links,omitempty"` - SchemaVersion ServiceDefinitionV2Dot1Version `json:"schema-version"` + SchemaVersion *ServiceDefinitionV2Dot1Version `json:"schema-version"` Tags []string `json:"tags,omitempty"` Team *string `json:"team,omitempty"` Tier *string `json:"tier,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.DdService == nil { - return fmt.Errorf("required field dd-service missing") - } - if required.SchemaVersion == nil { - return fmt.Errorf("required field schema-version missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -474,6 +459,12 @@ func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.DdService == nil { + return fmt.Errorf("required field dd-service missing") + } + if all.SchemaVersion == nil { + return fmt.Errorf("required field schema-version missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"application", "contacts", "dd-service", "description", "extensions", "integrations", "lifecycle", "links", "schema-version", "tags", "team", "tier"}) @@ -490,7 +481,7 @@ func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { } o.Application = all.Application o.Contacts = all.Contacts - o.DdService = all.DdService + o.DdService = *all.DdService o.Description = all.Description o.Extensions = all.Extensions if all.Integrations != nil && all.Integrations.UnparsedObject != nil && o.UnparsedObject == nil { @@ -503,7 +494,7 @@ func (o *ServiceDefinitionV2Dot1) UnmarshalJSON(bytes []byte) (err error) { o.Integrations = all.Integrations o.Lifecycle = all.Lifecycle o.Links = all.Links - o.SchemaVersion = all.SchemaVersion + o.SchemaVersion = *all.SchemaVersion o.Tags = all.Tags o.Team = all.Team o.Tier = all.Tier diff --git a/api/datadogV2/model_service_definition_v2_dot1_email.go b/api/datadogV2/model_service_definition_v2_dot1_email.go index fa3ab36401d..86dc4c413b8 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_email.go +++ b/api/datadogV2/model_service_definition_v2_dot1_email.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Dot1Email) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Email) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Contact *string `json:"contact"` + Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2Dot1EmailType `json:"type"` }{} - all := struct { - Contact string `json:"contact"` - Name *string `json:"name,omitempty"` - Type ServiceDefinitionV2Dot1EmailType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Contact == nil { - return fmt.Errorf("required field contact missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ServiceDefinitionV2Dot1Email) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "name", "type"}) @@ -180,9 +171,9 @@ func (o *ServiceDefinitionV2Dot1Email) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Contact = all.Contact + o.Contact = *all.Contact o.Name = all.Name - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_dot1_integrations.go b/api/datadogV2/model_service_definition_v2_dot1_integrations.go index 60f0c04e163..24af015afb3 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_integrations.go +++ b/api/datadogV2/model_service_definition_v2_dot1_integrations.go @@ -120,8 +120,7 @@ func (o *ServiceDefinitionV2Dot1Integrations) UnmarshalJSON(bytes []byte) (err e Opsgenie *ServiceDefinitionV2Dot1Opsgenie `json:"opsgenie,omitempty"` Pagerduty *ServiceDefinitionV2Dot1Pagerduty `json:"pagerduty,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v2_dot1_link.go b/api/datadogV2/model_service_definition_v2_dot1_link.go index 9eaf55f3731..27534fd6390 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_link.go +++ b/api/datadogV2/model_service_definition_v2_dot1_link.go @@ -165,32 +165,13 @@ func (o ServiceDefinitionV2Dot1Link) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Link) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Type *ServiceDefinitionV2Dot1LinkType `json:"type"` - Url *string `json:"url"` - }{} all := struct { - Name string `json:"name"` - Provider *string `json:"provider,omitempty"` - Type ServiceDefinitionV2Dot1LinkType `json:"type"` - Url string `json:"url"` + Name *string `json:"name"` + Provider *string `json:"provider,omitempty"` + Type *ServiceDefinitionV2Dot1LinkType `json:"type"` + Url *string `json:"url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,6 +179,15 @@ func (o *ServiceDefinitionV2Dot1Link) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "provider", "type", "url"}) @@ -212,10 +202,10 @@ func (o *ServiceDefinitionV2Dot1Link) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Name = all.Name + o.Name = *all.Name o.Provider = all.Provider - o.Type = all.Type - o.Url = all.Url + o.Type = *all.Type + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go b/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go index 2393c811551..4369a883b3f 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go +++ b/api/datadogV2/model_service_definition_v2_dot1_ms_teams.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Dot1MSTeams) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1MSTeams) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Contact *string `json:"contact"` + Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2Dot1MSTeamsType `json:"type"` }{} - all := struct { - Contact string `json:"contact"` - Name *string `json:"name,omitempty"` - Type ServiceDefinitionV2Dot1MSTeamsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Contact == nil { - return fmt.Errorf("required field contact missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ServiceDefinitionV2Dot1MSTeams) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "name", "type"}) @@ -180,9 +171,9 @@ func (o *ServiceDefinitionV2Dot1MSTeams) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } - o.Contact = all.Contact + o.Contact = *all.Contact o.Name = all.Name - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go b/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go index 59bc177f7f9..81da0d6d1e0 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go +++ b/api/datadogV2/model_service_definition_v2_dot1_opsgenie.go @@ -111,22 +111,11 @@ func (o ServiceDefinitionV2Dot1Opsgenie) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Opsgenie) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ServiceUrl *string `json:"service-url"` - }{} all := struct { Region *ServiceDefinitionV2Dot1OpsgenieRegion `json:"region,omitempty"` - ServiceUrl string `json:"service-url"` + ServiceUrl *string `json:"service-url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceUrl == nil { - return fmt.Errorf("required field service-url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *ServiceDefinitionV2Dot1Opsgenie) UnmarshalJSON(bytes []byte) (err error o.UnparsedObject = raw return nil } + if all.ServiceUrl == nil { + return fmt.Errorf("required field service-url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"region", "service-url"}) @@ -149,7 +141,7 @@ func (o *ServiceDefinitionV2Dot1Opsgenie) UnmarshalJSON(bytes []byte) (err error return nil } o.Region = all.Region - o.ServiceUrl = all.ServiceUrl + o.ServiceUrl = *all.ServiceUrl if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go b/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go index e4ce5b6eb92..ddc46f08e91 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go +++ b/api/datadogV2/model_service_definition_v2_dot1_pagerduty.go @@ -86,8 +86,7 @@ func (o *ServiceDefinitionV2Dot1Pagerduty) UnmarshalJSON(bytes []byte) (err erro all := struct { ServiceUrl *string `json:"service-url,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v2_dot1_slack.go b/api/datadogV2/model_service_definition_v2_dot1_slack.go index 6afb0d682be..b9e42962444 100644 --- a/api/datadogV2/model_service_definition_v2_dot1_slack.go +++ b/api/datadogV2/model_service_definition_v2_dot1_slack.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Dot1Slack) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Dot1Slack) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Contact *string `json:"contact"` + Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2Dot1SlackType `json:"type"` }{} - all := struct { - Contact string `json:"contact"` - Name *string `json:"name,omitempty"` - Type ServiceDefinitionV2Dot1SlackType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Contact == nil { - return fmt.Errorf("required field contact missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ServiceDefinitionV2Dot1Slack) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "name", "type"}) @@ -180,9 +171,9 @@ func (o *ServiceDefinitionV2Dot1Slack) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Contact = all.Contact + o.Contact = *all.Contact o.Name = all.Name - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_email.go b/api/datadogV2/model_service_definition_v2_email.go index 461b16392a0..f44c70da9b0 100644 --- a/api/datadogV2/model_service_definition_v2_email.go +++ b/api/datadogV2/model_service_definition_v2_email.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Email) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Email) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Contact *string `json:"contact"` + Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2EmailType `json:"type"` }{} - all := struct { - Contact string `json:"contact"` - Name *string `json:"name,omitempty"` - Type ServiceDefinitionV2EmailType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Contact == nil { - return fmt.Errorf("required field contact missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ServiceDefinitionV2Email) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "name", "type"}) @@ -180,9 +171,9 @@ func (o *ServiceDefinitionV2Email) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Contact = all.Contact + o.Contact = *all.Contact o.Name = all.Name - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_integrations.go b/api/datadogV2/model_service_definition_v2_integrations.go index 3f63213b856..9432872306a 100644 --- a/api/datadogV2/model_service_definition_v2_integrations.go +++ b/api/datadogV2/model_service_definition_v2_integrations.go @@ -120,8 +120,7 @@ func (o *ServiceDefinitionV2Integrations) UnmarshalJSON(bytes []byte) (err error Opsgenie *ServiceDefinitionV2Opsgenie `json:"opsgenie,omitempty"` Pagerduty *string `json:"pagerduty,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_service_definition_v2_link.go b/api/datadogV2/model_service_definition_v2_link.go index 67d10e97784..642c8a0dd34 100644 --- a/api/datadogV2/model_service_definition_v2_link.go +++ b/api/datadogV2/model_service_definition_v2_link.go @@ -132,31 +132,12 @@ func (o ServiceDefinitionV2Link) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Link) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Name *string `json:"name"` Type *ServiceDefinitionV2LinkType `json:"type"` Url *string `json:"url"` }{} - all := struct { - Name string `json:"name"` - Type ServiceDefinitionV2LinkType `json:"type"` - Url string `json:"url"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -164,6 +145,15 @@ func (o *ServiceDefinitionV2Link) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "type", "url"}) @@ -178,9 +168,9 @@ func (o *ServiceDefinitionV2Link) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Name = all.Name - o.Type = all.Type - o.Url = all.Url + o.Name = *all.Name + o.Type = *all.Type + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_ms_teams.go b/api/datadogV2/model_service_definition_v2_ms_teams.go index 98908ab0433..a371e7c725f 100644 --- a/api/datadogV2/model_service_definition_v2_ms_teams.go +++ b/api/datadogV2/model_service_definition_v2_ms_teams.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2MSTeams) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2MSTeams) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Contact *string `json:"contact"` + Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2MSTeamsType `json:"type"` }{} - all := struct { - Contact string `json:"contact"` - Name *string `json:"name,omitempty"` - Type ServiceDefinitionV2MSTeamsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Contact == nil { - return fmt.Errorf("required field contact missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ServiceDefinitionV2MSTeams) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "name", "type"}) @@ -180,9 +171,9 @@ func (o *ServiceDefinitionV2MSTeams) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Contact = all.Contact + o.Contact = *all.Contact o.Name = all.Name - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_opsgenie.go b/api/datadogV2/model_service_definition_v2_opsgenie.go index 39a8798e682..0eab94ff36c 100644 --- a/api/datadogV2/model_service_definition_v2_opsgenie.go +++ b/api/datadogV2/model_service_definition_v2_opsgenie.go @@ -111,22 +111,11 @@ func (o ServiceDefinitionV2Opsgenie) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Opsgenie) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - ServiceUrl *string `json:"service-url"` - }{} all := struct { Region *ServiceDefinitionV2OpsgenieRegion `json:"region,omitempty"` - ServiceUrl string `json:"service-url"` + ServiceUrl *string `json:"service-url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ServiceUrl == nil { - return fmt.Errorf("required field service-url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +123,9 @@ func (o *ServiceDefinitionV2Opsgenie) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.ServiceUrl == nil { + return fmt.Errorf("required field service-url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"region", "service-url"}) @@ -149,7 +141,7 @@ func (o *ServiceDefinitionV2Opsgenie) UnmarshalJSON(bytes []byte) (err error) { return nil } o.Region = all.Region - o.ServiceUrl = all.ServiceUrl + o.ServiceUrl = *all.ServiceUrl if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_repo.go b/api/datadogV2/model_service_definition_v2_repo.go index 0f37555b045..e91a7c8c97a 100644 --- a/api/datadogV2/model_service_definition_v2_repo.go +++ b/api/datadogV2/model_service_definition_v2_repo.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Repo) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Repo) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Name *string `json:"name"` - Url *string `json:"url"` - }{} all := struct { - Name string `json:"name"` + Name *string `json:"name"` Provider *string `json:"provider,omitempty"` - Url string `json:"url"` + Url *string `json:"url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,15 +151,21 @@ func (o *ServiceDefinitionV2Repo) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"name", "provider", "url"}) } else { return err } - o.Name = all.Name + o.Name = *all.Name o.Provider = all.Provider - o.Url = all.Url + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definition_v2_slack.go b/api/datadogV2/model_service_definition_v2_slack.go index 119e3e02702..9fbd057fc49 100644 --- a/api/datadogV2/model_service_definition_v2_slack.go +++ b/api/datadogV2/model_service_definition_v2_slack.go @@ -138,27 +138,12 @@ func (o ServiceDefinitionV2Slack) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ServiceDefinitionV2Slack) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Contact *string `json:"contact"` + Name *string `json:"name,omitempty"` Type *ServiceDefinitionV2SlackType `json:"type"` }{} - all := struct { - Contact string `json:"contact"` - Name *string `json:"name,omitempty"` - Type ServiceDefinitionV2SlackType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Contact == nil { - return fmt.Errorf("required field contact missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *ServiceDefinitionV2Slack) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Contact == nil { + return fmt.Errorf("required field contact missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"contact", "name", "type"}) @@ -180,9 +171,9 @@ func (o *ServiceDefinitionV2Slack) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.Contact = all.Contact + o.Contact = *all.Contact o.Name = all.Name - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_service_definitions_list_response.go b/api/datadogV2/model_service_definitions_list_response.go index 2620c0075ff..19b636db7a1 100644 --- a/api/datadogV2/model_service_definitions_list_response.go +++ b/api/datadogV2/model_service_definitions_list_response.go @@ -86,8 +86,7 @@ func (o *ServiceDefinitionsListResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data []ServiceDefinitionData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_slack_integration_metadata.go b/api/datadogV2/model_slack_integration_metadata.go index f78d09f6686..f6c4c4eedd2 100644 --- a/api/datadogV2/model_slack_integration_metadata.go +++ b/api/datadogV2/model_slack_integration_metadata.go @@ -78,21 +78,10 @@ func (o SlackIntegrationMetadata) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Channels *[]SlackIntegrationMetadataChannelItem `json:"channels"` - }{} all := struct { - Channels []SlackIntegrationMetadataChannelItem `json:"channels"` + Channels *[]SlackIntegrationMetadataChannelItem `json:"channels"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Channels == nil { - return fmt.Errorf("required field channels missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *SlackIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Channels == nil { + return fmt.Errorf("required field channels missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"channels"}) } else { return err } - o.Channels = all.Channels + o.Channels = *all.Channels if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_slack_integration_metadata_channel_item.go b/api/datadogV2/model_slack_integration_metadata_channel_item.go index 2b7e8807a63..2a358376159 100644 --- a/api/datadogV2/model_slack_integration_metadata_channel_item.go +++ b/api/datadogV2/model_slack_integration_metadata_channel_item.go @@ -165,32 +165,13 @@ func (o SlackIntegrationMetadataChannelItem) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackIntegrationMetadataChannelItem) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { ChannelId *string `json:"channel_id"` ChannelName *string `json:"channel_name"` RedirectUrl *string `json:"redirect_url"` - }{} - all := struct { - ChannelId string `json:"channel_id"` - ChannelName string `json:"channel_name"` - RedirectUrl string `json:"redirect_url"` TeamId *string `json:"team_id,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.ChannelId == nil { - return fmt.Errorf("required field channel_id missing") - } - if required.ChannelName == nil { - return fmt.Errorf("required field channel_name missing") - } - if required.RedirectUrl == nil { - return fmt.Errorf("required field redirect_url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -198,15 +179,24 @@ func (o *SlackIntegrationMetadataChannelItem) UnmarshalJSON(bytes []byte) (err e o.UnparsedObject = raw return nil } + if all.ChannelId == nil { + return fmt.Errorf("required field channel_id missing") + } + if all.ChannelName == nil { + return fmt.Errorf("required field channel_name missing") + } + if all.RedirectUrl == nil { + return fmt.Errorf("required field redirect_url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"channel_id", "channel_name", "redirect_url", "team_id"}) } else { return err } - o.ChannelId = all.ChannelId - o.ChannelName = all.ChannelName - o.RedirectUrl = all.RedirectUrl + o.ChannelId = *all.ChannelId + o.ChannelName = *all.ChannelName + o.RedirectUrl = *all.RedirectUrl o.TeamId = all.TeamId if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_spans_metric_compute.go b/api/datadogV2/model_spans_metric_compute.go index 1212a20285e..1569b346fae 100644 --- a/api/datadogV2/model_spans_metric_compute.go +++ b/api/datadogV2/model_spans_metric_compute.go @@ -145,23 +145,12 @@ func (o SpansMetricCompute) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCompute) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - AggregationType *SpansMetricComputeAggregationType `json:"aggregation_type"` - }{} all := struct { - AggregationType SpansMetricComputeAggregationType `json:"aggregation_type"` - IncludePercentiles *bool `json:"include_percentiles,omitempty"` - Path *string `json:"path,omitempty"` + AggregationType *SpansMetricComputeAggregationType `json:"aggregation_type"` + IncludePercentiles *bool `json:"include_percentiles,omitempty"` + Path *string `json:"path,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.AggregationType == nil { - return fmt.Errorf("required field aggregation_type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -169,6 +158,9 @@ func (o *SpansMetricCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.AggregationType == nil { + return fmt.Errorf("required field aggregation_type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"aggregation_type", "include_percentiles", "path"}) @@ -183,7 +175,7 @@ func (o *SpansMetricCompute) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } - o.AggregationType = all.AggregationType + o.AggregationType = *all.AggregationType o.IncludePercentiles = all.IncludePercentiles o.Path = all.Path if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_spans_metric_create_attributes.go b/api/datadogV2/model_spans_metric_create_attributes.go index 082c9e5f2e6..ff842941794 100644 --- a/api/datadogV2/model_spans_metric_create_attributes.go +++ b/api/datadogV2/model_spans_metric_create_attributes.go @@ -144,23 +144,12 @@ func (o SpansMetricCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Compute *SpansMetricCompute `json:"compute"` - }{} all := struct { - Compute SpansMetricCompute `json:"compute"` + Compute *SpansMetricCompute `json:"compute"` Filter *SpansMetricFilter `json:"filter,omitempty"` GroupBy []SpansMetricGroupBy `json:"group_by,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Compute == nil { - return fmt.Errorf("required field compute missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +157,9 @@ func (o *SpansMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Compute == nil { + return fmt.Errorf("required field compute missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"compute", "filter", "group_by"}) @@ -181,7 +173,7 @@ func (o *SpansMetricCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Compute = all.Compute + o.Compute = *all.Compute if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { diff --git a/api/datadogV2/model_spans_metric_create_data.go b/api/datadogV2/model_spans_metric_create_data.go index 44afc9312e5..9076257e6b6 100644 --- a/api/datadogV2/model_spans_metric_create_data.go +++ b/api/datadogV2/model_spans_metric_create_data.go @@ -134,31 +134,12 @@ func (o SpansMetricCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *SpansMetricCreateAttributes `json:"attributes"` Id *string `json:"id"` Type *SpansMetricType `json:"type"` }{} - all := struct { - Attributes SpansMetricCreateAttributes `json:"attributes"` - Id string `json:"id"` - Type SpansMetricType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *SpansMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *SpansMetricCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_spans_metric_create_request.go b/api/datadogV2/model_spans_metric_create_request.go index 9f05d47bdd2..29c83930550 100644 --- a/api/datadogV2/model_spans_metric_create_request.go +++ b/api/datadogV2/model_spans_metric_create_request.go @@ -78,21 +78,10 @@ func (o SpansMetricCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SpansMetricCreateData `json:"data"` - }{} all := struct { - Data SpansMetricCreateData `json:"data"` + Data *SpansMetricCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SpansMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SpansMetricCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_spans_metric_filter.go b/api/datadogV2/model_spans_metric_filter.go index 5f53ccda4d1..e3a6cf38f04 100644 --- a/api/datadogV2/model_spans_metric_filter.go +++ b/api/datadogV2/model_spans_metric_filter.go @@ -90,8 +90,7 @@ func (o *SpansMetricFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_group_by.go b/api/datadogV2/model_spans_metric_group_by.go index 20bd19d6cea..033241a35b9 100644 --- a/api/datadogV2/model_spans_metric_group_by.go +++ b/api/datadogV2/model_spans_metric_group_by.go @@ -111,22 +111,11 @@ func (o SpansMetricGroupBy) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Path *string `json:"path"` - }{} all := struct { - Path string `json:"path"` + Path *string `json:"path"` TagName *string `json:"tag_name,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Path == nil { - return fmt.Errorf("required field path missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,13 +123,16 @@ func (o *SpansMetricGroupBy) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Path == nil { + return fmt.Errorf("required field path missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"path", "tag_name"}) } else { return err } - o.Path = all.Path + o.Path = *all.Path o.TagName = all.TagName if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_spans_metric_response.go b/api/datadogV2/model_spans_metric_response.go index b7d5ad28016..ef62852045f 100644 --- a/api/datadogV2/model_spans_metric_response.go +++ b/api/datadogV2/model_spans_metric_response.go @@ -86,8 +86,7 @@ func (o *SpansMetricResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *SpansMetricResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_response_attributes.go b/api/datadogV2/model_spans_metric_response_attributes.go index 389548747d2..bf34f1ce0d6 100644 --- a/api/datadogV2/model_spans_metric_response_attributes.go +++ b/api/datadogV2/model_spans_metric_response_attributes.go @@ -154,8 +154,7 @@ func (o *SpansMetricResponseAttributes) UnmarshalJSON(bytes []byte) (err error) Filter *SpansMetricResponseFilter `json:"filter,omitempty"` GroupBy []SpansMetricResponseGroupBy `json:"group_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_response_compute.go b/api/datadogV2/model_spans_metric_response_compute.go index 3b8d2d7b9b5..d81810db3ad 100644 --- a/api/datadogV2/model_spans_metric_response_compute.go +++ b/api/datadogV2/model_spans_metric_response_compute.go @@ -155,8 +155,7 @@ func (o *SpansMetricResponseCompute) UnmarshalJSON(bytes []byte) (err error) { IncludePercentiles *bool `json:"include_percentiles,omitempty"` Path *string `json:"path,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_response_data.go b/api/datadogV2/model_spans_metric_response_data.go index 346ef2113d5..5f007f673e0 100644 --- a/api/datadogV2/model_spans_metric_response_data.go +++ b/api/datadogV2/model_spans_metric_response_data.go @@ -158,8 +158,7 @@ func (o *SpansMetricResponseData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *SpansMetricType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_response_filter.go b/api/datadogV2/model_spans_metric_response_filter.go index 6c93514b708..ee68b2e6be5 100644 --- a/api/datadogV2/model_spans_metric_response_filter.go +++ b/api/datadogV2/model_spans_metric_response_filter.go @@ -86,8 +86,7 @@ func (o *SpansMetricResponseFilter) UnmarshalJSON(bytes []byte) (err error) { all := struct { Query *string `json:"query,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_response_group_by.go b/api/datadogV2/model_spans_metric_response_group_by.go index e5dd25f4870..04827984499 100644 --- a/api/datadogV2/model_spans_metric_response_group_by.go +++ b/api/datadogV2/model_spans_metric_response_group_by.go @@ -120,8 +120,7 @@ func (o *SpansMetricResponseGroupBy) UnmarshalJSON(bytes []byte) (err error) { Path *string `json:"path,omitempty"` TagName *string `json:"tag_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_update_attributes.go b/api/datadogV2/model_spans_metric_update_attributes.go index 57b3cf0fd92..bc12502d5a9 100644 --- a/api/datadogV2/model_spans_metric_update_attributes.go +++ b/api/datadogV2/model_spans_metric_update_attributes.go @@ -154,8 +154,7 @@ func (o *SpansMetricUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { Filter *SpansMetricFilter `json:"filter,omitempty"` GroupBy []SpansMetricGroupBy `json:"group_by,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_update_compute.go b/api/datadogV2/model_spans_metric_update_compute.go index d8bdbc5c281..a6b67e69157 100644 --- a/api/datadogV2/model_spans_metric_update_compute.go +++ b/api/datadogV2/model_spans_metric_update_compute.go @@ -87,8 +87,7 @@ func (o *SpansMetricUpdateCompute) UnmarshalJSON(bytes []byte) (err error) { all := struct { IncludePercentiles *bool `json:"include_percentiles,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_spans_metric_update_data.go b/api/datadogV2/model_spans_metric_update_data.go index bf85bbe155f..ab69232d774 100644 --- a/api/datadogV2/model_spans_metric_update_data.go +++ b/api/datadogV2/model_spans_metric_update_data.go @@ -107,26 +107,11 @@ func (o SpansMetricUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *SpansMetricUpdateAttributes `json:"attributes"` Type *SpansMetricType `json:"type"` }{} - all := struct { - Attributes SpansMetricUpdateAttributes `json:"attributes"` - Type SpansMetricType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *SpansMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *SpansMetricUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_spans_metric_update_request.go b/api/datadogV2/model_spans_metric_update_request.go index 9f88eb0f95b..81942979ed7 100644 --- a/api/datadogV2/model_spans_metric_update_request.go +++ b/api/datadogV2/model_spans_metric_update_request.go @@ -78,21 +78,10 @@ func (o SpansMetricUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SpansMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *SpansMetricUpdateData `json:"data"` - }{} all := struct { - Data SpansMetricUpdateData `json:"data"` + Data *SpansMetricUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *SpansMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *SpansMetricUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_spans_metrics_response.go b/api/datadogV2/model_spans_metrics_response.go index 6374d9a8a5f..7175d12083e 100644 --- a/api/datadogV2/model_spans_metrics_response.go +++ b/api/datadogV2/model_spans_metrics_response.go @@ -86,8 +86,7 @@ func (o *SpansMetricsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []SpansMetricResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team.go b/api/datadogV2/model_team.go index 47384a3dec6..31306031d28 100644 --- a/api/datadogV2/model_team.go +++ b/api/datadogV2/model_team.go @@ -167,32 +167,13 @@ func (o Team) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *Team) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *TeamAttributes `json:"attributes"` - Id *string `json:"id"` - Type *TeamType `json:"type"` - }{} all := struct { - Attributes TeamAttributes `json:"attributes"` - Id string `json:"id"` + Attributes *TeamAttributes `json:"attributes"` + Id *string `json:"id"` Relationships *TeamRelationships `json:"relationships,omitempty"` - Type TeamType `json:"type"` + Type *TeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +181,15 @@ func (o *Team) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -221,8 +211,8 @@ func (o *Team) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id + o.Attributes = *all.Attributes + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -231,7 +221,7 @@ func (o *Team) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_attributes.go b/api/datadogV2/model_team_attributes.go index 90ddebf2b6a..da0f3dced38 100644 --- a/api/datadogV2/model_team_attributes.go +++ b/api/datadogV2/model_team_attributes.go @@ -334,32 +334,17 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Handle *string `json:"handle"` - Name *string `json:"name"` - }{} all := struct { CreatedAt *time.Time `json:"created_at,omitempty"` Description datadog.NullableString `json:"description,omitempty"` - Handle string `json:"handle"` + Handle *string `json:"handle"` LinkCount *int32 `json:"link_count,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name string `json:"name"` + Name *string `json:"name"` Summary datadog.NullableString `json:"summary,omitempty"` UserCount *int32 `json:"user_count,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Handle == nil { - return fmt.Errorf("required field handle missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -367,6 +352,12 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "description", "handle", "link_count", "modified_at", "name", "summary", "user_count"}) @@ -375,10 +366,10 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.CreatedAt = all.CreatedAt o.Description = all.Description - o.Handle = all.Handle + o.Handle = *all.Handle o.LinkCount = all.LinkCount o.ModifiedAt = all.ModifiedAt - o.Name = all.Name + o.Name = *all.Name o.Summary = all.Summary o.UserCount = all.UserCount if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_team_create.go b/api/datadogV2/model_team_create.go index d617ca71d78..832d5966eff 100644 --- a/api/datadogV2/model_team_create.go +++ b/api/datadogV2/model_team_create.go @@ -140,27 +140,12 @@ func (o TeamCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *TeamCreateAttributes `json:"attributes"` - Type *TeamType `json:"type"` - }{} all := struct { - Attributes TeamCreateAttributes `json:"attributes"` + Attributes *TeamCreateAttributes `json:"attributes"` Relationships *TeamCreateRelationships `json:"relationships,omitempty"` - Type TeamType `json:"type"` + Type *TeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *TeamCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -189,7 +180,7 @@ func (o *TeamCreate) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -198,7 +189,7 @@ func (o *TeamCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_create_attributes.go b/api/datadogV2/model_team_create_attributes.go index 1dbd3f97bc4..da514fde90f 100644 --- a/api/datadogV2/model_team_create_attributes.go +++ b/api/datadogV2/model_team_create_attributes.go @@ -138,27 +138,12 @@ func (o TeamCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Handle *string `json:"handle"` - Name *string `json:"name"` - }{} all := struct { Description *string `json:"description,omitempty"` - Handle string `json:"handle"` - Name string `json:"name"` + Handle *string `json:"handle"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Handle == nil { - return fmt.Errorf("required field handle missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +151,12 @@ func (o *TeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"description", "handle", "name"}) @@ -173,8 +164,8 @@ func (o *TeamCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { return err } o.Description = all.Description - o.Handle = all.Handle - o.Name = all.Name + o.Handle = *all.Handle + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_create_relationships.go b/api/datadogV2/model_team_create_relationships.go index f2e051d3904..a17f806c261 100644 --- a/api/datadogV2/model_team_create_relationships.go +++ b/api/datadogV2/model_team_create_relationships.go @@ -86,8 +86,7 @@ func (o *TeamCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { Users *RelationshipToUsers `json:"users,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_create_request.go b/api/datadogV2/model_team_create_request.go index 8f5c6a541ad..f5ea30136e1 100644 --- a/api/datadogV2/model_team_create_request.go +++ b/api/datadogV2/model_team_create_request.go @@ -78,21 +78,10 @@ func (o TeamCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *TeamCreate `json:"data"` - }{} all := struct { - Data TeamCreate `json:"data"` + Data *TeamCreate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *TeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *TeamCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_data.go b/api/datadogV2/model_team_data.go index b04a47ff2d9..f1a4d3008f2 100644 --- a/api/datadogV2/model_team_data.go +++ b/api/datadogV2/model_team_data.go @@ -134,31 +134,12 @@ func (o TeamData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *TeamAttributes `json:"attributes"` Id *string `json:"id"` Type *TeamType `json:"type"` }{} - all := struct { - Attributes TeamAttributes `json:"attributes"` - Id string `json:"id"` - Type TeamType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *TeamData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *TeamData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_link.go b/api/datadogV2/model_team_link.go index 8a00253efc0..de6a7fea329 100644 --- a/api/datadogV2/model_team_link.go +++ b/api/datadogV2/model_team_link.go @@ -134,31 +134,12 @@ func (o TeamLink) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLink) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *TeamLinkAttributes `json:"attributes"` Id *string `json:"id"` Type *TeamLinkType `json:"type"` }{} - all := struct { - Attributes TeamLinkAttributes `json:"attributes"` - Id string `json:"id"` - Type TeamLinkType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *TeamLink) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *TeamLink) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_link_attributes.go b/api/datadogV2/model_team_link_attributes.go index 178a7d22cc3..f45558519b8 100644 --- a/api/datadogV2/model_team_link_attributes.go +++ b/api/datadogV2/model_team_link_attributes.go @@ -171,28 +171,13 @@ func (o TeamLinkAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Label *string `json:"label"` - Url *string `json:"url"` - }{} all := struct { - Label string `json:"label"` + Label *string `json:"label"` Position *int32 `json:"position,omitempty"` TeamId *string `json:"team_id,omitempty"` - Url string `json:"url"` + Url *string `json:"url"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Label == nil { - return fmt.Errorf("required field label missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,16 +185,22 @@ func (o *TeamLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Label == nil { + return fmt.Errorf("required field label missing") + } + if all.Url == nil { + return fmt.Errorf("required field url missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"label", "position", "team_id", "url"}) } else { return err } - o.Label = all.Label + o.Label = *all.Label o.Position = all.Position o.TeamId = all.TeamId - o.Url = all.Url + o.Url = *all.Url if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_link_create.go b/api/datadogV2/model_team_link_create.go index 0a2469c35f6..0e0861dcc5d 100644 --- a/api/datadogV2/model_team_link_create.go +++ b/api/datadogV2/model_team_link_create.go @@ -107,26 +107,11 @@ func (o TeamLinkCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *TeamLinkAttributes `json:"attributes"` Type *TeamLinkType `json:"type"` }{} - all := struct { - Attributes TeamLinkAttributes `json:"attributes"` - Type TeamLinkType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *TeamLinkCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *TeamLinkCreate) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_link_create_request.go b/api/datadogV2/model_team_link_create_request.go index cb9dd96e140..61991ee2ce7 100644 --- a/api/datadogV2/model_team_link_create_request.go +++ b/api/datadogV2/model_team_link_create_request.go @@ -78,21 +78,10 @@ func (o TeamLinkCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *TeamLinkCreate `json:"data"` - }{} all := struct { - Data TeamLinkCreate `json:"data"` + Data *TeamLinkCreate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *TeamLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *TeamLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_link_response.go b/api/datadogV2/model_team_link_response.go index 96077940797..babcbca5036 100644 --- a/api/datadogV2/model_team_link_response.go +++ b/api/datadogV2/model_team_link_response.go @@ -86,8 +86,7 @@ func (o *TeamLinkResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *TeamLink `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_links_response.go b/api/datadogV2/model_team_links_response.go index 8cece2b17a3..fd0d63786dd 100644 --- a/api/datadogV2/model_team_links_response.go +++ b/api/datadogV2/model_team_links_response.go @@ -86,8 +86,7 @@ func (o *TeamLinksResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []TeamLink `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_permission_setting.go b/api/datadogV2/model_team_permission_setting.go index 93aa0dcfa28..8fc01b52ad7 100644 --- a/api/datadogV2/model_team_permission_setting.go +++ b/api/datadogV2/model_team_permission_setting.go @@ -140,27 +140,12 @@ func (o TeamPermissionSetting) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSetting) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *TeamPermissionSettingType `json:"type"` - }{} all := struct { Attributes *TeamPermissionSettingAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type TeamPermissionSettingType `json:"type"` + Id *string `json:"id"` + Type *TeamPermissionSettingType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *TeamPermissionSetting) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *TeamPermissionSetting) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_permission_setting_attributes.go b/api/datadogV2/model_team_permission_setting_attributes.go index fa919783478..2440f2f4e14 100644 --- a/api/datadogV2/model_team_permission_setting_attributes.go +++ b/api/datadogV2/model_team_permission_setting_attributes.go @@ -222,8 +222,7 @@ func (o *TeamPermissionSettingAttributes) UnmarshalJSON(bytes []byte) (err error Title *string `json:"title,omitempty"` Value *TeamPermissionSettingValue `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_permission_setting_response.go b/api/datadogV2/model_team_permission_setting_response.go index 869d233bf2d..36b19afae6b 100644 --- a/api/datadogV2/model_team_permission_setting_response.go +++ b/api/datadogV2/model_team_permission_setting_response.go @@ -86,8 +86,7 @@ func (o *TeamPermissionSettingResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data *TeamPermissionSetting `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_permission_setting_update.go b/api/datadogV2/model_team_permission_setting_update.go index 5594d63880a..d1aeed69eae 100644 --- a/api/datadogV2/model_team_permission_setting_update.go +++ b/api/datadogV2/model_team_permission_setting_update.go @@ -113,22 +113,11 @@ func (o TeamPermissionSettingUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingUpdate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *TeamPermissionSettingType `json:"type"` - }{} all := struct { Attributes *TeamPermissionSettingUpdateAttributes `json:"attributes,omitempty"` - Type TeamPermissionSettingType `json:"type"` + Type *TeamPermissionSettingType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -136,6 +125,9 @@ func (o *TeamPermissionSettingUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -158,7 +150,7 @@ func (o *TeamPermissionSettingUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_permission_setting_update_attributes.go b/api/datadogV2/model_team_permission_setting_update_attributes.go index 0e6b5a81a4b..7c21775acd3 100644 --- a/api/datadogV2/model_team_permission_setting_update_attributes.go +++ b/api/datadogV2/model_team_permission_setting_update_attributes.go @@ -86,8 +86,7 @@ func (o *TeamPermissionSettingUpdateAttributes) UnmarshalJSON(bytes []byte) (err all := struct { Value *TeamPermissionSettingValue `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_permission_setting_update_request.go b/api/datadogV2/model_team_permission_setting_update_request.go index 69366147e0b..265ad3b2add 100644 --- a/api/datadogV2/model_team_permission_setting_update_request.go +++ b/api/datadogV2/model_team_permission_setting_update_request.go @@ -78,21 +78,10 @@ func (o TeamPermissionSettingUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamPermissionSettingUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *TeamPermissionSettingUpdate `json:"data"` - }{} all := struct { - Data TeamPermissionSettingUpdate `json:"data"` + Data *TeamPermissionSettingUpdate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *TeamPermissionSettingUpdateRequest) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *TeamPermissionSettingUpdateRequest) UnmarshalJSON(bytes []byte) (err er } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_permission_settings_response.go b/api/datadogV2/model_team_permission_settings_response.go index 1da697b8997..b374b8cc6da 100644 --- a/api/datadogV2/model_team_permission_settings_response.go +++ b/api/datadogV2/model_team_permission_settings_response.go @@ -86,8 +86,7 @@ func (o *TeamPermissionSettingsResponse) UnmarshalJSON(bytes []byte) (err error) all := struct { Data []TeamPermissionSetting `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_relationships.go b/api/datadogV2/model_team_relationships.go index 854e8aa69bb..53963f1cb49 100644 --- a/api/datadogV2/model_team_relationships.go +++ b/api/datadogV2/model_team_relationships.go @@ -120,8 +120,7 @@ func (o *TeamRelationships) UnmarshalJSON(bytes []byte) (err error) { TeamLinks *RelationshipToTeamLinks `json:"team_links,omitempty"` UserTeamPermissions *RelationshipToUserTeamPermission `json:"user_team_permissions,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_response.go b/api/datadogV2/model_team_response.go index e84be362120..87189bc22bc 100644 --- a/api/datadogV2/model_team_response.go +++ b/api/datadogV2/model_team_response.go @@ -86,8 +86,7 @@ func (o *TeamResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *TeamData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_update.go b/api/datadogV2/model_team_update.go index 83e226d2daf..b1c00556dd0 100644 --- a/api/datadogV2/model_team_update.go +++ b/api/datadogV2/model_team_update.go @@ -140,27 +140,12 @@ func (o TeamUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *TeamUpdateAttributes `json:"attributes"` - Type *TeamType `json:"type"` - }{} all := struct { - Attributes TeamUpdateAttributes `json:"attributes"` + Attributes *TeamUpdateAttributes `json:"attributes"` Relationships *TeamUpdateRelationships `json:"relationships,omitempty"` - Type TeamType `json:"type"` + Type *TeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *TeamUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -189,7 +180,7 @@ func (o *TeamUpdate) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -198,7 +189,7 @@ func (o *TeamUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_update_attributes.go b/api/datadogV2/model_team_update_attributes.go index 6f9abbae37a..48430abd9d9 100644 --- a/api/datadogV2/model_team_update_attributes.go +++ b/api/datadogV2/model_team_update_attributes.go @@ -171,28 +171,13 @@ func (o TeamUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Handle *string `json:"handle"` - Name *string `json:"name"` - }{} all := struct { Color *int32 `json:"color,omitempty"` Description *string `json:"description,omitempty"` - Handle string `json:"handle"` - Name string `json:"name"` + Handle *string `json:"handle"` + Name *string `json:"name"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Handle == nil { - return fmt.Errorf("required field handle missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -200,6 +185,12 @@ func (o *TeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"color", "description", "handle", "name"}) @@ -208,8 +199,8 @@ func (o *TeamUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { } o.Color = all.Color o.Description = all.Description - o.Handle = all.Handle - o.Name = all.Name + o.Handle = *all.Handle + o.Name = *all.Name if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_team_update_relationships.go b/api/datadogV2/model_team_update_relationships.go index 74278cd6177..dacd61ea667 100644 --- a/api/datadogV2/model_team_update_relationships.go +++ b/api/datadogV2/model_team_update_relationships.go @@ -86,8 +86,7 @@ func (o *TeamUpdateRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { TeamLinks *RelationshipToTeamLinks `json:"team_links,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_team_update_request.go b/api/datadogV2/model_team_update_request.go index a31779864f3..5c2e4c667e4 100644 --- a/api/datadogV2/model_team_update_request.go +++ b/api/datadogV2/model_team_update_request.go @@ -78,21 +78,10 @@ func (o TeamUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *TeamUpdate `json:"data"` - }{} all := struct { - Data TeamUpdate `json:"data"` + Data *TeamUpdate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *TeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *TeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_teams_response.go b/api/datadogV2/model_teams_response.go index 2d011403cfa..47dbb70811e 100644 --- a/api/datadogV2/model_teams_response.go +++ b/api/datadogV2/model_teams_response.go @@ -120,8 +120,7 @@ func (o *TeamsResponse) UnmarshalJSON(bytes []byte) (err error) { Data []Team `json:"data,omitempty"` Included []TeamIncluded `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_timeseries_formula_query_request.go b/api/datadogV2/model_timeseries_formula_query_request.go index 8c755efa52e..a75104bfce0 100644 --- a/api/datadogV2/model_timeseries_formula_query_request.go +++ b/api/datadogV2/model_timeseries_formula_query_request.go @@ -78,21 +78,10 @@ func (o TimeseriesFormulaQueryRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *TimeseriesFormulaRequest `json:"data"` - }{} all := struct { - Data TimeseriesFormulaRequest `json:"data"` + Data *TimeseriesFormulaRequest `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *TimeseriesFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *TimeseriesFormulaQueryRequest) UnmarshalJSON(bytes []byte) (err error) } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_timeseries_formula_query_response.go b/api/datadogV2/model_timeseries_formula_query_response.go index ea2f9a5a3cd..b176268658e 100644 --- a/api/datadogV2/model_timeseries_formula_query_response.go +++ b/api/datadogV2/model_timeseries_formula_query_response.go @@ -120,8 +120,7 @@ func (o *TimeseriesFormulaQueryResponse) UnmarshalJSON(bytes []byte) (err error) Data *TimeseriesResponse `json:"data,omitempty"` Errors *string `json:"errors,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_timeseries_formula_request.go b/api/datadogV2/model_timeseries_formula_request.go index b3f01b4c6ba..21b0fa88f6f 100644 --- a/api/datadogV2/model_timeseries_formula_request.go +++ b/api/datadogV2/model_timeseries_formula_request.go @@ -107,26 +107,11 @@ func (o TimeseriesFormulaRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *TimeseriesFormulaRequestAttributes `json:"attributes"` Type *TimeseriesFormulaRequestType `json:"type"` }{} - all := struct { - Attributes TimeseriesFormulaRequestAttributes `json:"attributes"` - Type TimeseriesFormulaRequestType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *TimeseriesFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -155,8 +146,8 @@ func (o *TimeseriesFormulaRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Type = all.Type + o.Attributes = *all.Attributes + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_timeseries_formula_request_attributes.go b/api/datadogV2/model_timeseries_formula_request_attributes.go index f830512bdfa..7014e2688e9 100644 --- a/api/datadogV2/model_timeseries_formula_request_attributes.go +++ b/api/datadogV2/model_timeseries_formula_request_attributes.go @@ -201,33 +201,14 @@ func (o TimeseriesFormulaRequestAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TimeseriesFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - From *int64 `json:"from"` - Queries *[]TimeseriesQuery `json:"queries"` - To *int64 `json:"to"` - }{} all := struct { - Formulas []QueryFormula `json:"formulas,omitempty"` - From int64 `json:"from"` - Interval *int64 `json:"interval,omitempty"` - Queries []TimeseriesQuery `json:"queries"` - To int64 `json:"to"` + Formulas []QueryFormula `json:"formulas,omitempty"` + From *int64 `json:"from"` + Interval *int64 `json:"interval,omitempty"` + Queries *[]TimeseriesQuery `json:"queries"` + To *int64 `json:"to"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.From == nil { - return fmt.Errorf("required field from missing") - } - if required.Queries == nil { - return fmt.Errorf("required field queries missing") - } - if required.To == nil { - return fmt.Errorf("required field to missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -235,6 +216,15 @@ func (o *TimeseriesFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err er o.UnparsedObject = raw return nil } + if all.From == nil { + return fmt.Errorf("required field from missing") + } + if all.Queries == nil { + return fmt.Errorf("required field queries missing") + } + if all.To == nil { + return fmt.Errorf("required field to missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"formulas", "from", "interval", "queries", "to"}) @@ -242,10 +232,10 @@ func (o *TimeseriesFormulaRequestAttributes) UnmarshalJSON(bytes []byte) (err er return err } o.Formulas = all.Formulas - o.From = all.From + o.From = *all.From o.Interval = all.Interval - o.Queries = all.Queries - o.To = all.To + o.Queries = *all.Queries + o.To = *all.To if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_timeseries_response.go b/api/datadogV2/model_timeseries_response.go index 7a09e21cb56..8d052b2e5f8 100644 --- a/api/datadogV2/model_timeseries_response.go +++ b/api/datadogV2/model_timeseries_response.go @@ -124,8 +124,7 @@ func (o *TimeseriesResponse) UnmarshalJSON(bytes []byte) (err error) { Attributes *TimeseriesResponseAttributes `json:"attributes,omitempty"` Type *TimeseriesFormulaResponseType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_timeseries_response_attributes.go b/api/datadogV2/model_timeseries_response_attributes.go index 2dd04e442e4..abeffba241c 100644 --- a/api/datadogV2/model_timeseries_response_attributes.go +++ b/api/datadogV2/model_timeseries_response_attributes.go @@ -154,8 +154,7 @@ func (o *TimeseriesResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { Times []int64 `json:"times,omitempty"` Values [][]*float64 `json:"values,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_timeseries_response_series.go b/api/datadogV2/model_timeseries_response_series.go index 4f029b91226..0e3a9a90d35 100644 --- a/api/datadogV2/model_timeseries_response_series.go +++ b/api/datadogV2/model_timeseries_response_series.go @@ -157,8 +157,7 @@ func (o *TimeseriesResponseSeries) UnmarshalJSON(bytes []byte) (err error) { QueryIndex *int32 `json:"query_index,omitempty"` Unit []Unit `json:"unit,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_unit.go b/api/datadogV2/model_unit.go index 7cc8ff0bc78..9b6e42e2c0e 100644 --- a/api/datadogV2/model_unit.go +++ b/api/datadogV2/model_unit.go @@ -222,8 +222,7 @@ func (o *Unit) UnmarshalJSON(bytes []byte) (err error) { ScaleFactor *float64 `json:"scale_factor,omitempty"` ShortName *string `json:"short_name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_usage_application_security_monitoring_response.go b/api/datadogV2/model_usage_application_security_monitoring_response.go index e13e4c71b0d..6250078490b 100644 --- a/api/datadogV2/model_usage_application_security_monitoring_response.go +++ b/api/datadogV2/model_usage_application_security_monitoring_response.go @@ -86,8 +86,7 @@ func (o *UsageApplicationSecurityMonitoringResponse) UnmarshalJSON(bytes []byte) all := struct { Data []UsageDataObject `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_usage_attributes_object.go b/api/datadogV2/model_usage_attributes_object.go index bc5891fbcab..cd4bb690383 100644 --- a/api/datadogV2/model_usage_attributes_object.go +++ b/api/datadogV2/model_usage_attributes_object.go @@ -222,8 +222,7 @@ func (o *UsageAttributesObject) UnmarshalJSON(bytes []byte) (err error) { Timeseries []UsageTimeSeriesObject `json:"timeseries,omitempty"` UsageType *HourlyUsageType `json:"usage_type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_usage_data_object.go b/api/datadogV2/model_usage_data_object.go index 067762d1845..f756aa2a9e5 100644 --- a/api/datadogV2/model_usage_data_object.go +++ b/api/datadogV2/model_usage_data_object.go @@ -158,8 +158,7 @@ func (o *UsageDataObject) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *UsageTimeSeriesType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_usage_lambda_traced_invocations_response.go b/api/datadogV2/model_usage_lambda_traced_invocations_response.go index 4dc730f7681..1c5991c2643 100644 --- a/api/datadogV2/model_usage_lambda_traced_invocations_response.go +++ b/api/datadogV2/model_usage_lambda_traced_invocations_response.go @@ -86,8 +86,7 @@ func (o *UsageLambdaTracedInvocationsResponse) UnmarshalJSON(bytes []byte) (err all := struct { Data []UsageDataObject `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_usage_observability_pipelines_response.go b/api/datadogV2/model_usage_observability_pipelines_response.go index 7e50c1b6bfb..b56efb0841e 100644 --- a/api/datadogV2/model_usage_observability_pipelines_response.go +++ b/api/datadogV2/model_usage_observability_pipelines_response.go @@ -86,8 +86,7 @@ func (o *UsageObservabilityPipelinesResponse) UnmarshalJSON(bytes []byte) (err e all := struct { Data []UsageDataObject `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_usage_time_series_object.go b/api/datadogV2/model_usage_time_series_object.go index a4b17fc76a0..e9c15d00a04 100644 --- a/api/datadogV2/model_usage_time_series_object.go +++ b/api/datadogV2/model_usage_time_series_object.go @@ -136,8 +136,7 @@ func (o *UsageTimeSeriesObject) UnmarshalJSON(bytes []byte) (err error) { Timestamp *time.Time `json:"timestamp,omitempty"` Value datadog.NullableInt64 `json:"value,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user.go b/api/datadogV2/model_user.go index db118f0ee4a..9ac7ad95bae 100644 --- a/api/datadogV2/model_user.go +++ b/api/datadogV2/model_user.go @@ -192,8 +192,7 @@ func (o *User) UnmarshalJSON(bytes []byte) (err error) { Relationships *UserResponseRelationships `json:"relationships,omitempty"` Type *UsersType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_attributes.go b/api/datadogV2/model_user_attributes.go index 55cfffc58bd..6eb47fa129b 100644 --- a/api/datadogV2/model_user_attributes.go +++ b/api/datadogV2/model_user_attributes.go @@ -457,8 +457,7 @@ func (o *UserAttributes) UnmarshalJSON(bytes []byte) (err error) { Title datadog.NullableString `json:"title,omitempty"` Verified *bool `json:"verified,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_create_attributes.go b/api/datadogV2/model_user_create_attributes.go index 272b146afb5..81c1e2cdf30 100644 --- a/api/datadogV2/model_user_create_attributes.go +++ b/api/datadogV2/model_user_create_attributes.go @@ -144,23 +144,12 @@ func (o UserCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Email *string `json:"email"` - }{} all := struct { - Email string `json:"email"` + Email *string `json:"email"` Name *string `json:"name,omitempty"` Title *string `json:"title,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Email == nil { - return fmt.Errorf("required field email missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,13 +157,16 @@ func (o *UserCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Email == nil { + return fmt.Errorf("required field email missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"email", "name", "title"}) } else { return err } - o.Email = all.Email + o.Email = *all.Email o.Name = all.Name o.Title = all.Title if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_user_create_data.go b/api/datadogV2/model_user_create_data.go index 6843e95987a..1ae67911326 100644 --- a/api/datadogV2/model_user_create_data.go +++ b/api/datadogV2/model_user_create_data.go @@ -140,27 +140,12 @@ func (o UserCreateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Attributes *UserCreateAttributes `json:"attributes"` - Type *UsersType `json:"type"` - }{} all := struct { - Attributes UserCreateAttributes `json:"attributes"` - Relationships *UserRelationships `json:"relationships,omitempty"` - Type UsersType `json:"type"` + Attributes *UserCreateAttributes `json:"attributes"` + Relationships *UserRelationships `json:"relationships,omitempty"` + Type *UsersType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -189,7 +180,7 @@ func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes + o.Attributes = *all.Attributes if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -198,7 +189,7 @@ func (o *UserCreateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_create_request.go b/api/datadogV2/model_user_create_request.go index 83d86887773..a006b123552 100644 --- a/api/datadogV2/model_user_create_request.go +++ b/api/datadogV2/model_user_create_request.go @@ -78,21 +78,10 @@ func (o UserCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *UserCreateData `json:"data"` - }{} all := struct { - Data UserCreateData `json:"data"` + Data *UserCreateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *UserCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_invitation_data.go b/api/datadogV2/model_user_invitation_data.go index fc5846b0392..5c3c56a85dd 100644 --- a/api/datadogV2/model_user_invitation_data.go +++ b/api/datadogV2/model_user_invitation_data.go @@ -107,26 +107,11 @@ func (o UserInvitationData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Relationships *UserInvitationRelationships `json:"relationships"` Type *UserInvitationsType `json:"type"` }{} - all := struct { - Relationships UserInvitationRelationships `json:"relationships"` - Type UserInvitationsType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Relationships == nil { - return fmt.Errorf("required field relationships missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -134,6 +119,12 @@ func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"relationships", "type"}) @@ -155,8 +146,8 @@ func (o *UserInvitationData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Relationships = all.Relationships - o.Type = all.Type + o.Relationships = *all.Relationships + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_invitation_data_attributes.go b/api/datadogV2/model_user_invitation_data_attributes.go index ed0924ed49e..03c68713060 100644 --- a/api/datadogV2/model_user_invitation_data_attributes.go +++ b/api/datadogV2/model_user_invitation_data_attributes.go @@ -197,8 +197,7 @@ func (o *UserInvitationDataAttributes) UnmarshalJSON(bytes []byte) (err error) { InviteType *string `json:"invite_type,omitempty"` Uuid *string `json:"uuid,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_invitation_relationships.go b/api/datadogV2/model_user_invitation_relationships.go index 7e99b1fd7d9..820d7c9d7e5 100644 --- a/api/datadogV2/model_user_invitation_relationships.go +++ b/api/datadogV2/model_user_invitation_relationships.go @@ -78,21 +78,10 @@ func (o UserInvitationRelationships) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - User *RelationshipToUser `json:"user"` - }{} all := struct { - User RelationshipToUser `json:"user"` + User *RelationshipToUser `json:"user"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.User == nil { - return fmt.Errorf("required field user missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.User == nil { + return fmt.Errorf("required field user missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"user"}) @@ -113,7 +105,7 @@ func (o *UserInvitationRelationships) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.User = all.User + o.User = *all.User if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_invitation_response.go b/api/datadogV2/model_user_invitation_response.go index cca57f904d7..7060e73d346 100644 --- a/api/datadogV2/model_user_invitation_response.go +++ b/api/datadogV2/model_user_invitation_response.go @@ -86,8 +86,7 @@ func (o *UserInvitationResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *UserInvitationResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_invitation_response_data.go b/api/datadogV2/model_user_invitation_response_data.go index 0e0f5a52bdc..de39bea6cb1 100644 --- a/api/datadogV2/model_user_invitation_response_data.go +++ b/api/datadogV2/model_user_invitation_response_data.go @@ -158,8 +158,7 @@ func (o *UserInvitationResponseData) UnmarshalJSON(bytes []byte) (err error) { Id *string `json:"id,omitempty"` Type *UserInvitationsType `json:"type,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_invitations_request.go b/api/datadogV2/model_user_invitations_request.go index ca345d0031e..54192d01fc5 100644 --- a/api/datadogV2/model_user_invitations_request.go +++ b/api/datadogV2/model_user_invitations_request.go @@ -78,21 +78,10 @@ func (o UserInvitationsRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserInvitationsRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *[]UserInvitationData `json:"data"` - }{} all := struct { - Data []UserInvitationData `json:"data"` + Data *[]UserInvitationData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,13 +89,16 @@ func (o *UserInvitationsRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_invitations_response.go b/api/datadogV2/model_user_invitations_response.go index 373d3667a6f..e86fce031b2 100644 --- a/api/datadogV2/model_user_invitations_response.go +++ b/api/datadogV2/model_user_invitations_response.go @@ -86,8 +86,7 @@ func (o *UserInvitationsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []UserInvitationResponseData `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_relationships.go b/api/datadogV2/model_user_relationships.go index e71bdd9f22f..caac51b8a81 100644 --- a/api/datadogV2/model_user_relationships.go +++ b/api/datadogV2/model_user_relationships.go @@ -86,8 +86,7 @@ func (o *UserRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { Roles *RelationshipToRoles `json:"roles,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_response.go b/api/datadogV2/model_user_response.go index 14c44ac3d12..4b8344865f0 100644 --- a/api/datadogV2/model_user_response.go +++ b/api/datadogV2/model_user_response.go @@ -120,8 +120,7 @@ func (o *UserResponse) UnmarshalJSON(bytes []byte) (err error) { Data *User `json:"data,omitempty"` Included []UserResponseIncludedItem `json:"included,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_response_relationships.go b/api/datadogV2/model_user_response_relationships.go index 77331af131b..d184099d488 100644 --- a/api/datadogV2/model_user_response_relationships.go +++ b/api/datadogV2/model_user_response_relationships.go @@ -188,8 +188,7 @@ func (o *UserResponseRelationships) UnmarshalJSON(bytes []byte) (err error) { OtherUsers *RelationshipToUsers `json:"other_users,omitempty"` Roles *RelationshipToRoles `json:"roles,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_team.go b/api/datadogV2/model_user_team.go index 8347dce3378..517515a9319 100644 --- a/api/datadogV2/model_user_team.go +++ b/api/datadogV2/model_user_team.go @@ -173,28 +173,13 @@ func (o UserTeam) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *UserTeamType `json:"type"` - }{} all := struct { Attributes *UserTeamAttributes `json:"attributes,omitempty"` - Id string `json:"id"` + Id *string `json:"id"` Relationships *UserTeamRelationships `json:"relationships,omitempty"` - Type UserTeamType `json:"type"` + Type *UserTeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -202,6 +187,12 @@ func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) @@ -224,7 +215,7 @@ func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id + o.Id = *all.Id if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { err = json.Unmarshal(bytes, &raw) if err != nil { @@ -233,7 +224,7 @@ func (o *UserTeam) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_team_attributes.go b/api/datadogV2/model_user_team_attributes.go index d53385ce44c..ca70bbf085f 100644 --- a/api/datadogV2/model_user_team_attributes.go +++ b/api/datadogV2/model_user_team_attributes.go @@ -97,8 +97,7 @@ func (o *UserTeamAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { Role NullableUserTeamRole `json:"role,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_team_create.go b/api/datadogV2/model_user_team_create.go index 906790e9939..3bff2e8bf25 100644 --- a/api/datadogV2/model_user_team_create.go +++ b/api/datadogV2/model_user_team_create.go @@ -146,23 +146,12 @@ func (o UserTeamCreate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamCreate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *UserTeamType `json:"type"` - }{} all := struct { Attributes *UserTeamAttributes `json:"attributes,omitempty"` Relationships *UserTeamRelationships `json:"relationships,omitempty"` - Type UserTeamType `json:"type"` + Type *UserTeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -170,6 +159,9 @@ func (o *UserTeamCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) @@ -200,7 +192,7 @@ func (o *UserTeamCreate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Relationships = all.Relationships - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_team_permission.go b/api/datadogV2/model_user_team_permission.go index f729b85c999..fc206598988 100644 --- a/api/datadogV2/model_user_team_permission.go +++ b/api/datadogV2/model_user_team_permission.go @@ -140,27 +140,12 @@ func (o UserTeamPermission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Id *string `json:"id"` - Type *UserTeamPermissionType `json:"type"` - }{} all := struct { Attributes *UserTeamPermissionAttributes `json:"attributes,omitempty"` - Id string `json:"id"` - Type UserTeamPermissionType `json:"type"` + Id *string `json:"id"` + Type *UserTeamPermissionType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -168,6 +153,12 @@ func (o *UserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -190,8 +181,8 @@ func (o *UserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_team_permission_attributes.go b/api/datadogV2/model_user_team_permission_attributes.go index f7f9aea3f16..c7d91c78bf3 100644 --- a/api/datadogV2/model_user_team_permission_attributes.go +++ b/api/datadogV2/model_user_team_permission_attributes.go @@ -86,8 +86,7 @@ func (o *UserTeamPermissionAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { Permissions interface{} `json:"permissions,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_team_relationships.go b/api/datadogV2/model_user_team_relationships.go index c270b18fb49..956f5f0aa92 100644 --- a/api/datadogV2/model_user_team_relationships.go +++ b/api/datadogV2/model_user_team_relationships.go @@ -86,8 +86,7 @@ func (o *UserTeamRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { User *RelationshipToUserTeamUser `json:"user,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_team_request.go b/api/datadogV2/model_user_team_request.go index c7ad2e2165d..edb8f2ddb6f 100644 --- a/api/datadogV2/model_user_team_request.go +++ b/api/datadogV2/model_user_team_request.go @@ -78,21 +78,10 @@ func (o UserTeamRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *UserTeamCreate `json:"data"` - }{} all := struct { - Data UserTeamCreate `json:"data"` + Data *UserTeamCreate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *UserTeamRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *UserTeamRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_team_response.go b/api/datadogV2/model_user_team_response.go index 40d1da4a7f2..23dbb2f6d99 100644 --- a/api/datadogV2/model_user_team_response.go +++ b/api/datadogV2/model_user_team_response.go @@ -86,8 +86,7 @@ func (o *UserTeamResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data *UserTeam `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_team_update.go b/api/datadogV2/model_user_team_update.go index d436c1aa1b7..c49b55a87f3 100644 --- a/api/datadogV2/model_user_team_update.go +++ b/api/datadogV2/model_user_team_update.go @@ -113,22 +113,11 @@ func (o UserTeamUpdate) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamUpdate) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Type *UserTeamType `json:"type"` - }{} all := struct { Attributes *UserTeamAttributes `json:"attributes,omitempty"` - Type UserTeamType `json:"type"` + Type *UserTeamType `json:"type"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -136,6 +125,9 @@ func (o *UserTeamUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -158,7 +150,7 @@ func (o *UserTeamUpdate) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw } o.Attributes = all.Attributes - o.Type = all.Type + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_team_update_request.go b/api/datadogV2/model_user_team_update_request.go index 725a6dd3827..4d26935a639 100644 --- a/api/datadogV2/model_user_team_update_request.go +++ b/api/datadogV2/model_user_team_update_request.go @@ -78,21 +78,10 @@ func (o UserTeamUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *UserTeamUpdate `json:"data"` - }{} all := struct { - Data UserTeamUpdate `json:"data"` + Data *UserTeamUpdate `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *UserTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *UserTeamUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_teams_response.go b/api/datadogV2/model_user_teams_response.go index bd93d11fcfe..6a56cb05211 100644 --- a/api/datadogV2/model_user_teams_response.go +++ b/api/datadogV2/model_user_teams_response.go @@ -86,8 +86,7 @@ func (o *UserTeamsResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { Data []UserTeam `json:"data,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_update_attributes.go b/api/datadogV2/model_user_update_attributes.go index 6b2283a7735..be14b65cb74 100644 --- a/api/datadogV2/model_user_update_attributes.go +++ b/api/datadogV2/model_user_update_attributes.go @@ -154,8 +154,7 @@ func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { Email *string `json:"email,omitempty"` Name *string `json:"name,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err diff --git a/api/datadogV2/model_user_update_data.go b/api/datadogV2/model_user_update_data.go index 51b58a85bc9..694802b0b3c 100644 --- a/api/datadogV2/model_user_update_data.go +++ b/api/datadogV2/model_user_update_data.go @@ -134,31 +134,12 @@ func (o UserUpdateData) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { + all := struct { Attributes *UserUpdateAttributes `json:"attributes"` Id *string `json:"id"` Type *UsersType `json:"type"` }{} - all := struct { - Attributes UserUpdateAttributes `json:"attributes"` - Id string `json:"id"` - Type UsersType `json:"type"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Type == nil { - return fmt.Errorf("required field type missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -166,6 +147,15 @@ func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) @@ -187,9 +177,9 @@ func (o *UserUpdateData) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Attributes = all.Attributes - o.Id = all.Id - o.Type = all.Type + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_user_update_request.go b/api/datadogV2/model_user_update_request.go index 03aee5f8603..6d34df3484c 100644 --- a/api/datadogV2/model_user_update_request.go +++ b/api/datadogV2/model_user_update_request.go @@ -78,21 +78,10 @@ func (o UserUpdateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} - required := struct { - Data *UserUpdateData `json:"data"` - }{} all := struct { - Data UserUpdateData `json:"data"` + Data *UserUpdateData `json:"data"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Data == nil { - return fmt.Errorf("required field data missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -100,6 +89,9 @@ func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { o.UnparsedObject = raw return nil } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -113,7 +105,7 @@ func (o *UserUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { } o.UnparsedObject = raw } - o.Data = all.Data + o.Data = *all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_users_response.go b/api/datadogV2/model_users_response.go index 1c69a6852ac..696fca27c88 100644 --- a/api/datadogV2/model_users_response.go +++ b/api/datadogV2/model_users_response.go @@ -154,8 +154,7 @@ func (o *UsersResponse) UnmarshalJSON(bytes []byte) (err error) { Included []UserResponseIncludedItem `json:"included,omitempty"` Meta *ResponseMetaAttributes `json:"meta,omitempty"` }{} - err = json.Unmarshal(bytes, &all) - if err != nil { + if err = json.Unmarshal(bytes, &all); err != nil { err = json.Unmarshal(bytes, &raw) if err != nil { return err From b6c242fabd3ba3d95c674ada55a0ca00010f91e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Mon, 26 Jun 2023 15:44:42 +0200 Subject: [PATCH 2/3] Unwanted change --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eab5a887beb..8343ea3265d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,7 @@ repos: - id: generator name: generator language: python - entry: bash -c "unset VIRTUAL_ENV && cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../api/" + entry: bash -c "cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../api/" files: "^.generator/(config|schemas/v1|src|poetry.lock|pyproject.toml)" stages: [manual] pass_filenames: false @@ -51,7 +51,7 @@ repos: - id: examples name: examples language: python - entry: bash -c "unset VIRTUAL_ENV && cd .generator && poetry install && poetry run pytest" + entry: bash -c "cd .generator && poetry install && poetry run pytest" files: "^.generator/" stages: [manual] pass_filenames: false From ccea5e4f645daa50629788e34e58acb7774336a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Herv=C3=A9?= Date: Mon, 26 Jun 2023 15:47:28 +0200 Subject: [PATCH 3/3] Rebase --- .../model_ci_app_pipeline_event_job.go | 129 +----------- .../model_ci_app_pipeline_event_pipeline.go | 115 +---------- .../model_ci_app_pipeline_event_stage.go | 115 +---------- .../model_ci_app_pipeline_event_step.go | 121 +---------- api/datadogV2/model_ci_app_user_info.go | 195 ------------------ 5 files changed, 14 insertions(+), 661 deletions(-) delete mode 100644 api/datadogV2/model_ci_app_user_info.go diff --git a/api/datadogV2/model_ci_app_pipeline_event_job.go b/api/datadogV2/model_ci_app_pipeline_event_job.go index cf99a882a06..7339c1cde85 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_job.go +++ b/api/datadogV2/model_ci_app_pipeline_event_job.go @@ -721,50 +721,13 @@ func (o CIAppPipelineEventJob) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} -<<<<<<< HEAD - required := struct { - End *time.Time `json:"end"` - Git NullableCIAppGitInfo `json:"git"` - Id *string `json:"id"` - Level *CIAppPipelineEventJobLevel `json:"level"` - Name *string `json:"name"` - PipelineName *string `json:"pipeline_name"` - PipelineUniqueId *string `json:"pipeline_unique_id"` - Start *time.Time `json:"start"` - Status *CIAppPipelineEventJobStatus `json:"status"` - Url *string `json:"url"` - }{} -||||||| parent of 04c075be8 (Remove required unmarshal in models) - required := struct { - End *time.Time `json:"end"` - Id *string `json:"id"` - Level *CIAppPipelineEventJobLevel `json:"level"` - Name *string `json:"name"` - PipelineName *string `json:"pipeline_name"` - PipelineUniqueId *string `json:"pipeline_unique_id"` - Start *time.Time `json:"start"` - Status *CIAppPipelineEventJobStatus `json:"status"` - Url *string `json:"url"` - }{} -======= ->>>>>>> 04c075be8 (Remove required unmarshal in models) all := struct { Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` End *time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` -<<<<<<< HEAD Git NullableCIAppGitInfo `json:"git"` - Id string `json:"id"` - Level CIAppPipelineEventJobLevel `json:"level"` -||||||| parent of 04c075be8 (Remove required unmarshal in models) - Git NullableCIAppGitInfo `json:"git,omitempty"` - Id string `json:"id"` - Level CIAppPipelineEventJobLevel `json:"level"` -======= - Git NullableCIAppGitInfo `json:"git,omitempty"` Id *string `json:"id"` Level *CIAppPipelineEventJobLevel `json:"level"` ->>>>>>> 04c075be8 (Remove required unmarshal in models) Metrics datadog.NullableList[string] `json:"metrics,omitempty"` Name *string `json:"name"` Node NullableCIAppHostInfo `json:"node,omitempty"` @@ -777,90 +740,9 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { Start *time.Time `json:"start"` Status *CIAppPipelineEventJobStatus `json:"status"` Tags datadog.NullableList[string] `json:"tags,omitempty"` -<<<<<<< HEAD - Url string `json:"url"` -||||||| parent of 04c075be8 (Remove required unmarshal in models) - Url string `json:"url"` - User NullableCIAppUserInfo `json:"user,omitempty"` -======= Url *string `json:"url"` - User NullableCIAppUserInfo `json:"user,omitempty"` ->>>>>>> 04c075be8 (Remove required unmarshal in models) }{} -<<<<<<< HEAD - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if !required.Git.IsSet() { - return fmt.Errorf("required field git missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PipelineName == nil { - return fmt.Errorf("required field pipeline_name missing") - } - if required.PipelineUniqueId == nil { - return fmt.Errorf("required field pipeline_unique_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -||||||| parent of 04c075be8 (Remove required unmarshal in models) - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PipelineName == nil { - return fmt.Errorf("required field pipeline_name missing") - } - if required.PipelineUniqueId == nil { - return fmt.Errorf("required field pipeline_unique_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -======= if err = json.Unmarshal(bytes, &all); err != nil { ->>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -871,6 +753,9 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { if all.End == nil { return fmt.Errorf("required field end missing") } + if !all.Git.IsSet() { + return fmt.Errorf("required field git missing") + } if all.Id == nil { return fmt.Errorf("required field id missing") } @@ -935,15 +820,7 @@ func (o *CIAppPipelineEventJob) UnmarshalJSON(bytes []byte) (err error) { o.Start = *all.Start o.Status = *all.Status o.Tags = all.Tags -<<<<<<< HEAD - o.Url = all.Url -||||||| parent of 04c075be8 (Remove required unmarshal in models) - o.Url = all.Url - o.User = all.User -======= o.Url = *all.Url - o.User = all.User ->>>>>>> 04c075be8 (Remove required unmarshal in models) if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ci_app_pipeline_event_pipeline.go b/api/datadogV2/model_ci_app_pipeline_event_pipeline.go index 40adeaed2ff..6a3d3128902 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_pipeline.go +++ b/api/datadogV2/model_ci_app_pipeline_event_pipeline.go @@ -774,31 +774,6 @@ func (o CIAppPipelineEventPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} -<<<<<<< HEAD - required := struct { - End *time.Time `json:"end"` - Git NullableCIAppGitInfo `json:"git"` - Level *CIAppPipelineEventPipelineLevel `json:"level"` - Name *string `json:"name"` - PartialRetry *bool `json:"partial_retry"` - Start *time.Time `json:"start"` - Status *CIAppPipelineEventPipelineStatus `json:"status"` - UniqueId *string `json:"unique_id"` - Url *string `json:"url"` - }{} -||||||| parent of 04c075be8 (Remove required unmarshal in models) - required := struct { - End *time.Time `json:"end"` - Level *CIAppPipelineEventPipelineLevel `json:"level"` - Name *string `json:"name"` - PartialRetry *bool `json:"partial_retry"` - Start *time.Time `json:"start"` - Status *CIAppPipelineEventPipelineStatus `json:"status"` - UniqueId *string `json:"unique_id"` - Url *string `json:"url"` - }{} -======= ->>>>>>> 04c075be8 (Remove required unmarshal in models) all := struct { End *time.Time `json:"end"` Error NullableCIAppCIError `json:"error,omitempty"` @@ -818,87 +793,10 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { Start *time.Time `json:"start"` Status *CIAppPipelineEventPipelineStatus `json:"status"` Tags datadog.NullableList[string] `json:"tags,omitempty"` -<<<<<<< HEAD - UniqueId string `json:"unique_id"` - Url string `json:"url"` -||||||| parent of 04c075be8 (Remove required unmarshal in models) - UniqueId string `json:"unique_id"` - Url string `json:"url"` - User NullableCIAppUserInfo `json:"user,omitempty"` -======= UniqueId *string `json:"unique_id"` Url *string `json:"url"` - User NullableCIAppUserInfo `json:"user,omitempty"` ->>>>>>> 04c075be8 (Remove required unmarshal in models) }{} -<<<<<<< HEAD - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if !required.Git.IsSet() { - return fmt.Errorf("required field git missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PartialRetry == nil { - return fmt.Errorf("required field partial_retry missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - if required.UniqueId == nil { - return fmt.Errorf("required field unique_id missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -||||||| parent of 04c075be8 (Remove required unmarshal in models) - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PartialRetry == nil { - return fmt.Errorf("required field partial_retry missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - if required.UniqueId == nil { - return fmt.Errorf("required field unique_id missing") - } - if required.Url == nil { - return fmt.Errorf("required field url missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -======= if err = json.Unmarshal(bytes, &all); err != nil { ->>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -909,6 +807,9 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { if all.End == nil { return fmt.Errorf("required field end missing") } + if !all.Git.IsSet() { + return fmt.Errorf("required field git missing") + } if all.Level == nil { return fmt.Errorf("required field level missing") } @@ -970,18 +871,8 @@ func (o *CIAppPipelineEventPipeline) UnmarshalJSON(bytes []byte) (err error) { o.Start = *all.Start o.Status = *all.Status o.Tags = all.Tags -<<<<<<< HEAD - o.UniqueId = all.UniqueId - o.Url = all.Url -||||||| parent of 04c075be8 (Remove required unmarshal in models) - o.UniqueId = all.UniqueId - o.Url = all.Url - o.User = all.User -======= o.UniqueId = *all.UniqueId o.Url = *all.Url - o.User = all.User ->>>>>>> 04c075be8 (Remove required unmarshal in models) if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } diff --git a/api/datadogV2/model_ci_app_pipeline_event_stage.go b/api/datadogV2/model_ci_app_pipeline_event_stage.go index 0d4be6ee16e..a7e16b8726c 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_stage.go +++ b/api/datadogV2/model_ci_app_pipeline_event_stage.go @@ -609,13 +609,8 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { all := struct { Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` End *time.Time `json:"end"` -<<<<<<< HEAD - Git NullableCIAppGitInfo `json:"git"` -||||||| parent of 04c075be8 (Remove required unmarshal in models) -======= Error NullableCIAppCIError `json:"error,omitempty"` - Git NullableCIAppGitInfo `json:"git,omitempty"` ->>>>>>> 04c075be8 (Remove required unmarshal in models) + Git NullableCIAppGitInfo `json:"git"` Id *string `json:"id"` Level *CIAppPipelineEventStageLevel `json:"level"` Metrics datadog.NullableList[string] `json:"metrics,omitempty"` @@ -628,113 +623,8 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { Start *time.Time `json:"start"` Status *CIAppPipelineEventStageStatus `json:"status"` Tags datadog.NullableList[string] `json:"tags,omitempty"` - User NullableCIAppUserInfo `json:"user,omitempty"` - }{} -<<<<<<< HEAD - all := struct { - Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` - End time.Time `json:"end"` - Error NullableCIAppCIError `json:"error,omitempty"` - Git NullableCIAppGitInfo `json:"git"` - Id string `json:"id"` - Level CIAppPipelineEventStageLevel `json:"level"` - Metrics datadog.NullableList[string] `json:"metrics,omitempty"` - Name string `json:"name"` - Node NullableCIAppHostInfo `json:"node,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - PipelineName string `json:"pipeline_name"` - PipelineUniqueId string `json:"pipeline_unique_id"` - QueueTime datadog.NullableInt64 `json:"queue_time,omitempty"` - Start time.Time `json:"start"` - Status CIAppPipelineEventStageStatus `json:"status"` - Tags datadog.NullableList[string] `json:"tags,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if !required.Git.IsSet() { - return fmt.Errorf("required field git missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PipelineName == nil { - return fmt.Errorf("required field pipeline_name missing") - } - if required.PipelineUniqueId == nil { - return fmt.Errorf("required field pipeline_unique_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -||||||| parent of 04c075be8 (Remove required unmarshal in models) - all := struct { - Dependencies datadog.NullableList[string] `json:"dependencies,omitempty"` - End time.Time `json:"end"` - Error NullableCIAppCIError `json:"error,omitempty"` - Git NullableCIAppGitInfo `json:"git,omitempty"` - Id string `json:"id"` - Level CIAppPipelineEventStageLevel `json:"level"` - Metrics datadog.NullableList[string] `json:"metrics,omitempty"` - Name string `json:"name"` - Node NullableCIAppHostInfo `json:"node,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - PipelineName string `json:"pipeline_name"` - PipelineUniqueId string `json:"pipeline_unique_id"` - QueueTime datadog.NullableInt64 `json:"queue_time,omitempty"` - Start time.Time `json:"start"` - Status CIAppPipelineEventStageStatus `json:"status"` - Tags datadog.NullableList[string] `json:"tags,omitempty"` - User NullableCIAppUserInfo `json:"user,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PipelineName == nil { - return fmt.Errorf("required field pipeline_name missing") - } - if required.PipelineUniqueId == nil { - return fmt.Errorf("required field pipeline_unique_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -======= if err = json.Unmarshal(bytes, &all); err != nil { ->>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -745,6 +635,9 @@ func (o *CIAppPipelineEventStage) UnmarshalJSON(bytes []byte) (err error) { if all.End == nil { return fmt.Errorf("required field end missing") } + if !all.Git.IsSet() { + return fmt.Errorf("required field git missing") + } if all.Id == nil { return fmt.Errorf("required field id missing") } diff --git a/api/datadogV2/model_ci_app_pipeline_event_step.go b/api/datadogV2/model_ci_app_pipeline_event_step.go index 937c03ba13c..99a9b64c470 100644 --- a/api/datadogV2/model_ci_app_pipeline_event_step.go +++ b/api/datadogV2/model_ci_app_pipeline_event_step.go @@ -740,13 +740,8 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} all := struct { End *time.Time `json:"end"` -<<<<<<< HEAD - Git NullableCIAppGitInfo `json:"git"` -||||||| parent of 04c075be8 (Remove required unmarshal in models) -======= Error NullableCIAppCIError `json:"error,omitempty"` - Git NullableCIAppGitInfo `json:"git,omitempty"` ->>>>>>> 04c075be8 (Remove required unmarshal in models) + Git NullableCIAppGitInfo `json:"git"` Id *string `json:"id"` JobId datadog.NullableString `json:"job_id,omitempty"` JobName datadog.NullableString `json:"job_name,omitempty"` @@ -763,119 +758,8 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { Status *CIAppPipelineEventStepStatus `json:"status"` Tags datadog.NullableList[string] `json:"tags,omitempty"` Url datadog.NullableString `json:"url,omitempty"` - User NullableCIAppUserInfo `json:"user,omitempty"` - }{} -<<<<<<< HEAD - all := struct { - End time.Time `json:"end"` - Error NullableCIAppCIError `json:"error,omitempty"` - Git NullableCIAppGitInfo `json:"git"` - Id string `json:"id"` - JobId datadog.NullableString `json:"job_id,omitempty"` - JobName datadog.NullableString `json:"job_name,omitempty"` - Level CIAppPipelineEventStepLevel `json:"level"` - Metrics datadog.NullableList[string] `json:"metrics,omitempty"` - Name string `json:"name"` - Node NullableCIAppHostInfo `json:"node,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - PipelineName string `json:"pipeline_name"` - PipelineUniqueId string `json:"pipeline_unique_id"` - StageId datadog.NullableString `json:"stage_id,omitempty"` - StageName datadog.NullableString `json:"stage_name,omitempty"` - Start time.Time `json:"start"` - Status CIAppPipelineEventStepStatus `json:"status"` - Tags datadog.NullableList[string] `json:"tags,omitempty"` - Url datadog.NullableString `json:"url,omitempty"` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if !required.Git.IsSet() { - return fmt.Errorf("required field git missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PipelineName == nil { - return fmt.Errorf("required field pipeline_name missing") - } - if required.PipelineUniqueId == nil { - return fmt.Errorf("required field pipeline_unique_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -||||||| parent of 04c075be8 (Remove required unmarshal in models) - all := struct { - End time.Time `json:"end"` - Error NullableCIAppCIError `json:"error,omitempty"` - Git NullableCIAppGitInfo `json:"git,omitempty"` - Id string `json:"id"` - JobId datadog.NullableString `json:"job_id,omitempty"` - JobName datadog.NullableString `json:"job_name,omitempty"` - Level CIAppPipelineEventStepLevel `json:"level"` - Metrics datadog.NullableList[string] `json:"metrics,omitempty"` - Name string `json:"name"` - Node NullableCIAppHostInfo `json:"node,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - PipelineName string `json:"pipeline_name"` - PipelineUniqueId string `json:"pipeline_unique_id"` - StageId datadog.NullableString `json:"stage_id,omitempty"` - StageName datadog.NullableString `json:"stage_name,omitempty"` - Start time.Time `json:"start"` - Status CIAppPipelineEventStepStatus `json:"status"` - Tags datadog.NullableList[string] `json:"tags,omitempty"` - Url datadog.NullableString `json:"url,omitempty"` - User NullableCIAppUserInfo `json:"user,omitempty"` }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.End == nil { - return fmt.Errorf("required field end missing") - } - if required.Id == nil { - return fmt.Errorf("required field id missing") - } - if required.Level == nil { - return fmt.Errorf("required field level missing") - } - if required.Name == nil { - return fmt.Errorf("required field name missing") - } - if required.PipelineName == nil { - return fmt.Errorf("required field pipeline_name missing") - } - if required.PipelineUniqueId == nil { - return fmt.Errorf("required field pipeline_unique_id missing") - } - if required.Start == nil { - return fmt.Errorf("required field start missing") - } - if required.Status == nil { - return fmt.Errorf("required field status missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { -======= if err = json.Unmarshal(bytes, &all); err != nil { ->>>>>>> 04c075be8 (Remove required unmarshal in models) err = json.Unmarshal(bytes, &raw) if err != nil { return err @@ -886,6 +770,9 @@ func (o *CIAppPipelineEventStep) UnmarshalJSON(bytes []byte) (err error) { if all.End == nil { return fmt.Errorf("required field end missing") } + if !all.Git.IsSet() { + return fmt.Errorf("required field git missing") + } if all.Id == nil { return fmt.Errorf("required field id missing") } diff --git a/api/datadogV2/model_ci_app_user_info.go b/api/datadogV2/model_ci_app_user_info.go deleted file mode 100644 index ad0dd855172..00000000000 --- a/api/datadogV2/model_ci_app_user_info.go +++ /dev/null @@ -1,195 +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. - -package datadogV2 - -import ( - "encoding/json" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// CIAppUserInfo Used to specify user-related information when the payload does not have Git information. -// For example, if Git information is missing for manually triggered pipelines, this field can be used instead. -type CIAppUserInfo struct { - // Email of the user. - Email *string `json:"email,omitempty"` - // Name of the user. - Name *string `json:"name,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} -} - -// NewCIAppUserInfo instantiates a new CIAppUserInfo object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewCIAppUserInfo() *CIAppUserInfo { - this := CIAppUserInfo{} - return &this -} - -// NewCIAppUserInfoWithDefaults instantiates a new CIAppUserInfo object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewCIAppUserInfoWithDefaults() *CIAppUserInfo { - this := CIAppUserInfo{} - return &this -} - -// GetEmail returns the Email field value if set, zero value otherwise. -func (o *CIAppUserInfo) GetEmail() string { - if o == nil || o.Email == nil { - var ret string - return ret - } - return *o.Email -} - -// GetEmailOk returns a tuple with the Email field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CIAppUserInfo) GetEmailOk() (*string, bool) { - if o == nil || o.Email == nil { - return nil, false - } - return o.Email, true -} - -// HasEmail returns a boolean if a field has been set. -func (o *CIAppUserInfo) HasEmail() bool { - return o != nil && o.Email != nil -} - -// SetEmail gets a reference to the given string and assigns it to the Email field. -func (o *CIAppUserInfo) SetEmail(v string) { - o.Email = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *CIAppUserInfo) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CIAppUserInfo) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *CIAppUserInfo) HasName() bool { - return o != nil && o.Name != nil -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *CIAppUserInfo) SetName(v string) { - o.Name = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o CIAppUserInfo) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return json.Marshal(o.UnparsedObject) - } - if o.Email != nil { - toSerialize["email"] = o.Email - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return json.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *CIAppUserInfo) UnmarshalJSON(bytes []byte) (err error) { - raw := map[string]interface{}{} - all := struct { - Email *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` - }{} - if err = json.Unmarshal(bytes, &all); err != nil { - err = json.Unmarshal(bytes, &raw) - if err != nil { - return err - } - o.UnparsedObject = raw - return nil - } - additionalProperties := make(map[string]interface{}) - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"email", "name"}) - } else { - return err - } - o.Email = all.Email - o.Name = all.Name - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} - -// NullableCIAppUserInfo handles when a null is used for CIAppUserInfo. -type NullableCIAppUserInfo struct { - value *CIAppUserInfo - isSet bool -} - -// Get returns the associated value. -func (v NullableCIAppUserInfo) Get() *CIAppUserInfo { - return v.value -} - -// Set changes the value and indicates it's been called. -func (v *NullableCIAppUserInfo) Set(val *CIAppUserInfo) { - v.value = val - v.isSet = true -} - -// IsSet returns whether Set has been called. -func (v NullableCIAppUserInfo) IsSet() bool { - return v.isSet -} - -// Unset sets the value to nil and resets the set flag/ -func (v *NullableCIAppUserInfo) Unset() { - v.value = nil - v.isSet = false -} - -// NewNullableCIAppUserInfo initializes the struct as if Set has been called. -func NewNullableCIAppUserInfo(val *CIAppUserInfo) *NullableCIAppUserInfo { - return &NullableCIAppUserInfo{value: val, isSet: true} -} - -// MarshalJSON serializes the associated value. -func (v NullableCIAppUserInfo) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. -func (v *NullableCIAppUserInfo) UnmarshalJSON(src []byte) error { - v.isSet = true - - // this object is nullable so check if the payload is null or empty string - if string(src) == "" || string(src) == "{}" { - return nil - } - - return json.Unmarshal(src, &v.value) -}